From 6eb35ac0ca024dea1c96c69acadf70d90ef65e43 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 28 Feb 2021 21:45:36 -0800 Subject: [PATCH 001/139] Fix changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3dfa525..0e8306130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [0.3.4] - 2021-02-28 +## [0.3.5] - 2021-02-28 ### Fixed - Case where `raycastFirst` failed to return a valid result. -## [0.3.3] - 2021-02-25 +## [0.3.4] - 2021-02-25 ### Changed - Raycast result to return a custom intersection object aligned with three.js v0.126.0. From 59ae26086e8b63b9773cecb102e06457031e049d Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 28 Feb 2021 22:18:28 -0800 Subject: [PATCH 002/139] Delete generateAsync.js --- src/workers/generateAsync.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 src/workers/generateAsync.js diff --git a/src/workers/generateAsync.js b/src/workers/generateAsync.js deleted file mode 100644 index e6844020c..000000000 --- a/src/workers/generateAsync.js +++ /dev/null @@ -1,9 +0,0 @@ -import { GenerateMeshBVHWorker } from './GenerateMeshBVHWorker.js'; - -export function generateAsync( geometry, options = {} ) { - - console.warn( 'MeshBVH: "generateAsync" is deprecated. Use MeshBVHGenerationWorker instead.' ); - - return new GenerateMeshBVHWorker().generate( geometry, options ); - -} From 843a4265491a13b6d2462a58609cfcc498dbfb98 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 28 Feb 2021 22:22:39 -0800 Subject: [PATCH 003/139] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e8306130..cc62dfcf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## Unreleased +### Changed +- Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. + ## [0.3.5] - 2021-02-28 ### Fixed - Case where `raycastFirst` failed to return a valid result. From 65c4584c008eded0950627ff528faf224035bec8 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:28:25 -0800 Subject: [PATCH 004/139] Update MeshBVH.js --- src/MeshBVH.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 0bad89bd3..a741427ba 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -200,12 +200,10 @@ export default class MeshBVH { maxDepth: 40, maxLeafTris: 10, verbose: true, - lazyGeneration: true, // undocumented options - // whether to the pack the data as a buffer or not. The data - // will not be packed if lazyGeneration is true. + // whether to the pack the data as a buffer or not. packData: true, // Whether to skip generating the tree. Used for deserialization. @@ -219,7 +217,7 @@ export default class MeshBVH { if ( ! options[ SKIP_GENERATION ] ) { this._roots = buildTree( geo, options ); - if ( ! options.lazyGeneration && options.packData ) { + if ( options.packData ) { this._roots = MeshBVH.serialize( this, geo, false ).roots; this._isPacked = true; From cfec46a82f44a009de2a09b94d89d63c686ee2fb Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:31:29 -0800 Subject: [PATCH 005/139] Update buildFunctions.js --- src/buildFunctions.js | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/src/buildFunctions.js b/src/buildFunctions.js index 03bada9eb..a9b1658ed 100644 --- a/src/buildFunctions.js +++ b/src/buildFunctions.js @@ -552,23 +552,8 @@ export function buildTree( geo, options ) { node.left = left; left.boundingData = new Float32Array( 6 ); - if ( lazyGeneration ) { - - getBounds( triangleBounds, lstart, lcount, left.boundingData ); - left.continueGeneration = function () { - - delete this.continueGeneration; - getCentroidBounds( triangleBounds, lstart, lcount, cacheCentroidBoundingData ); - splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); - - }; - - } else { - - getBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData ); - splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); - - } + getBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData ); + splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); // repeat for right const right = new MeshBVHNode(); @@ -577,23 +562,8 @@ export function buildTree( geo, options ) { node.right = right; right.boundingData = new Float32Array( 6 ); - if ( lazyGeneration ) { - - getBounds( triangleBounds, rstart, rcount, right.boundingData ); - right.continueGeneration = function () { - - delete this.continueGeneration; - getCentroidBounds( triangleBounds, rstart, rcount, cacheCentroidBoundingData ); - splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); - - }; - - } else { - - getBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData ); - splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); - - } + getBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData ); + splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); } @@ -611,7 +581,6 @@ export function buildTree( geo, options ) { const verbose = options.verbose; const maxLeafTris = options.maxLeafTris; const strategy = options.strategy; - const lazyGeneration = options.lazyGeneration; let reachedMaxDepth = false; const roots = []; From 9a829572960fef8ffe2215b4247369d6468e1297 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:32:39 -0800 Subject: [PATCH 006/139] Update castFunctions.js --- src/castFunctions.js | 46 -------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/castFunctions.js b/src/castFunctions.js index e79abd3ba..9efd3aa89 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -21,12 +21,6 @@ function intersectRay( node, ray, target ) { export function raycast( node, mesh, raycaster, ray, intersects ) { - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - const isLeaf = ! ! node.count; if ( isLeaf ) { @@ -52,12 +46,6 @@ export function raycast( node, mesh, raycaster, ray, intersects ) { export function raycastFirst( node, mesh, raycaster, ray ) { - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - const isLeaf = ! ! node.count; if ( isLeaf ) { @@ -178,20 +166,9 @@ export const shapecast = ( function () { // when converting to the buffer equivalents function getLeftOffset( node ) { - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - while ( ! node.count ) { node = node.left; - if ( /* skip */ node.continueGeneration ) { - - node.continueGeneration(); - - } } @@ -201,20 +178,9 @@ export const shapecast = ( function () { function getRightEndOffset( node ) { - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - while ( ! node.count ) { node = node.right; - if ( /* skip */ node.continueGeneration ) { - - node.continueGeneration(); - - } } @@ -222,12 +188,6 @@ export const shapecast = ( function () { } - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - const isLeaf = ! ! node.count; if ( isLeaf && intersectsTriangleFunc ) { @@ -371,12 +331,6 @@ export const intersectsGeometry = ( function () { return function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) { - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - if ( cachedObb === null ) { if ( ! geometry.boundingBox ) { From 749992008a415446ddf7af3a21477a5fc74e60d5 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:34:48 -0800 Subject: [PATCH 007/139] Update README.md --- README.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/README.md b/README.md index 7eb71c064..a54dfc29e 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ const invMat = new THREE.Matrix4(); // ... -const bvh = new MeshBVH( geometry, { lazyGeneration: false } ); +const bvh = new MeshBVH( geometry ); invMat.copy( mesh.matrixWorld ).invert(); // raycasting @@ -224,16 +224,6 @@ Constructs the bounds tree for the given geometry and produces a new index attri // Print out warnings encountered during tree construction. verbose: true, - // If true the bounds tree is generated progressively as the tree is used allowing - // for a fast initialization time and memory allocation as needed but a higher memory - // footprint once the tree is completed. The initial raycasts are also slower until the - // tree is built up. - // If false then the bounds tree will be completely generated up front and packed into - // an array buffer for a lower final memory footprint and long initialization time. - // Note that this will keep intermediate buffers needed for generation in scope until - // the tree has been fully generated. - lazyGeneration: true - } ``` From 0552efad4ca155eef9c494a3cd70043ebfe4dc10 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:47:04 -0800 Subject: [PATCH 008/139] Update Debug.js --- src/Utils/Debug.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Utils/Debug.js b/src/Utils/Debug.js index 66e99c8e0..521939241 100644 --- a/src/Utils/Debug.js +++ b/src/Utils/Debug.js @@ -36,7 +36,7 @@ function getRootExtremes( bvh, group ) { splits: [ 0, 0, 0 ] }; - bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { + bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => { result.total ++; if ( isLeaf ) { @@ -44,8 +44,8 @@ function getRootExtremes( bvh, group ) { result.depth.min = Math.min( depth, result.depth.min ); result.depth.max = Math.max( depth, result.depth.max ); - result.tris.min = Math.min( countOrIsUnfinished, result.tris.min ); - result.tris.max = Math.max( countOrIsUnfinished, result.tris.max ); + result.tris.min = Math.min( count, result.tris.min ); + result.tris.max = Math.max( count, result.tris.max ); } else { From f5d41ab3b0d4de98df9c117338f0bb7b3cd991dd Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:47:28 -0800 Subject: [PATCH 009/139] Update MeshBVH.js --- src/MeshBVH.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index a741427ba..681e6e70d 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -37,23 +37,6 @@ export default class MeshBVH { static serialize( bvh, geometry, copyIndexBuffer = true ) { - function finishTree( node ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - - if ( ! node.count ) { - - finishTree( node.left ); - finishTree( node.right ); - - } - - } - function countNodes( node ) { if ( node.count ) { @@ -125,7 +108,6 @@ export default class MeshBVH { for ( let i = 0; i < roots.length; i ++ ) { const root = roots[ i ]; - finishTree( root ); let nodeCount = countNodes( root ); const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); @@ -252,7 +234,7 @@ export default class MeshBVH { const left = stride4Offset + BYTES_PER_NODE / 4; const right = uint32Array[ stride4Offset + 6 ]; const splitAxis = uint32Array[ stride4Offset + 7 ]; - const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis, false ); + const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis ); if ( ! stopTraversal ) { @@ -278,7 +260,7 @@ export default class MeshBVH { } else { - const stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis, ! ! node.continueGeneration ); + const stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis ); if ( ! stopTraversal ) { From e4c89df3c59ab9e2bf2cf3668c5689cba95d88b7 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:52:56 -0800 Subject: [PATCH 010/139] use type: module --- benchmark/index.js | 2 -- package-lock.json | 55 ------------------------------ package.json | 6 ++-- scripts/generate-cast-functions.js | 4 +-- 4 files changed, 5 insertions(+), 62 deletions(-) delete mode 100644 benchmark/index.js diff --git a/benchmark/index.js b/benchmark/index.js deleted file mode 100644 index 51f190e84..000000000 --- a/benchmark/index.js +++ /dev/null @@ -1,2 +0,0 @@ -require( '@babel/register' )( { ignore: [ /node_modules\/(?!three)/ ] } ); -require( './run-benchmark.js' ); diff --git a/package-lock.json b/package-lock.json index 7f333524c..4a0fe3145 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2913,19 +2913,6 @@ "esutils": "^2.0.2" } }, - "@babel/register": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.12.1.tgz", - "integrity": "sha512-XWcmseMIncOjoydKZnWvWi0/5CUCD+ZYKhRwgYlWOrA8fGZ/FjuLRpqtIhLOVD/fvR1b9DQHtZPn68VvhpYf+Q==", - "dev": true, - "requires": { - "find-cache-dir": "^2.0.0", - "lodash": "^4.17.19", - "make-dir": "^2.1.0", - "pirates": "^4.0.0", - "source-map-support": "^0.5.16" - } - }, "@babel/runtime": { "version": "7.8.4", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.8.4.tgz", @@ -5011,12 +4998,6 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -6583,17 +6564,6 @@ } } }, - "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - } - }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -10435,16 +10405,6 @@ "vlq": "^0.2.2" } }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, "makeerror": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", @@ -11304,12 +11264,6 @@ "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==", "dev": true }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, "pirates": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", @@ -11319,15 +11273,6 @@ "node-modules-regexp": "^1.0.0" } }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, "pn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", diff --git a/package.json b/package.json index 6471cbc10..3c32ae4ec 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,15 @@ "version": "0.3.5", "description": "A BVH implementation to speed up raycasting against three.js meshes.", "module": "src/index.js", - "main": "umd/index.js", + "main": "src/index.js", + "type": "module", "scripts": { "start": "concurrently \"parcel watch ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache\" \"rollup -w -c\" \"static-server\"", "generate-cast-functions": "node ./scripts/generate-cast-functions.js", "build": "npm run generate-cast-functions && rollup -c & parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", "test": "npm run generate-cast-functions && jest", "lint": "npm run generate-cast-functions && eslint \"./src/*.js\" \"./test/*.js\" \"./example/*.js\"", - "benchmark": "npm run generate-cast-functions && node benchmark/index.js" + "benchmark": "npm run generate-cast-functions && node benchmark/run-benchmark.js" }, "files": [ "src/*", @@ -50,7 +51,6 @@ "devDependencies": { "@babel/core": "^7.12.9", "@babel/preset-env": "^7.12.7", - "@babel/register": "^7.12.1", "babel-jest": "^26.6.3", "concurrently": "^5.3.0", "dat.gui": "^0.7.3", diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index 6d27eb3aa..6fc2c3c08 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -1,5 +1,5 @@ -const fs = require( 'fs' ); -const path = require( 'path' ); +import fs from 'fs'; +import path from 'path'; // Replace unneeded function definitions and checks. The `continueGeneration` block is always at the top of // a function definition so we can replace that with local variable definitions we need. From 934d35d3fca92a9cc733a49365a0194dae2cbdc2 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:54:02 -0800 Subject: [PATCH 011/139] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc62dfcf1..b16b10ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. +- Use `type: module` in the package.json ## [0.3.5] - 2021-02-28 ### Fixed From 1e70de69ee1422293870f0dddb1d488fbcb71023 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:54:13 -0800 Subject: [PATCH 012/139] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b16b10ba5..7b8892620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. -- Use `type: module` in the package.json +- Use `type: module` in package.json. ## [0.3.5] - 2021-02-28 ### Fixed From e6b498477ea65bbe10b350a59e4a633b0d00e829 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:56:42 -0800 Subject: [PATCH 013/139] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8892620..6a640d31e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. -- Use `type: module` in package.json. +- Use `type: module` in package.json to enable use of es6 modules in node. ## [0.3.5] - 2021-02-28 ### Fixed From 813346bb2dc3ae46919efe8f44dd66d6d2423c61 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 18:57:57 -0800 Subject: [PATCH 014/139] Update node.js.yml --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 05451203b..9bc9b5d7d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [14.x] steps: - uses: actions/checkout@v2 From 11f8d118d536e7e60a1a2350003e34e684b1d9ed Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 19:17:56 -0800 Subject: [PATCH 015/139] Fix cast function generation --- scripts/generate-cast-functions.js | 35 ++++++++++++------------------ src/castFunctionsBuffer.js | 6 +++-- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index 6d27eb3aa..37a502ef0 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -5,27 +5,6 @@ const path = require( 'path' ); // a function definition so we can replace that with local variable definitions we need. function replaceUnneededCode( str ) { - str = str.replace( - /if \( [^)]*node.continueGeneration \)(.|\n|\r)*?}[\r|\n]/mg, - match => { - - if ( match.indexOf( '/* skip */' ) !== - 1 ) { - - return ''; - - } else { - - return 'let stride2Offset = stride4Offset * 2, ' + - 'float32Array = _float32Array, ' + - 'uint16Array = _uint16Array, ' + - 'uint32Array = _uint32Array;\n'; - - } - - } - - ); - str = str.replace( /function intersectRay\((.|[\r\n])*?}[\r|\n]/mg, '' ); str = str.replace( /import { arrayToBox.*?;[\r\n]/g, '' ); @@ -152,6 +131,20 @@ function replaceFunctionNames( str ) { } ); + str = str.replace( + new RegExp( `\n(.+?)${ orNames }.+? {`, 'gm' ), + match => { + + const whitespace = match.match( /^\s+/ )[ 0 ]; + return match + '\n' + whitespace + '\t' + + 'let stride2Offset = stride4Offset * 2, ' + + 'float32Array = _float32Array, ' + + 'uint16Array = _uint16Array, ' + + 'uint32Array = _uint32Array;\n'; + + } + ); + return str; } diff --git a/src/castFunctionsBuffer.js b/src/castFunctionsBuffer.js index e50195511..4b4d3fdbd 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctionsBuffer.js @@ -118,6 +118,8 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { export const shapecastBuffer = ( function () { + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + const _triangle = new SeparatingAxisTriangle(); const _cachedBox1 = new Box3(); const _cachedBox2 = new Box3(); @@ -192,8 +194,6 @@ export const shapecastBuffer = ( function () { } - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); if ( isLeaf && intersectsTriangleFunc ) { @@ -327,6 +327,8 @@ export const shapecastBuffer = ( function () { export const intersectsGeometryBuffer = ( function () { + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + const triangle = new SeparatingAxisTriangle(); const triangle2 = new SeparatingAxisTriangle(); const cachedMesh = new Mesh(); From 6fbecbf6b8285f2009ba6ca0114e17f0010e47c7 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 19:19:31 -0800 Subject: [PATCH 016/139] Revert "Fix cast function generation" This reverts commit 11f8d118d536e7e60a1a2350003e34e684b1d9ed. --- scripts/generate-cast-functions.js | 35 ++++++++++++++++++------------ src/castFunctionsBuffer.js | 6 ++--- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index 37a502ef0..6d27eb3aa 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -5,6 +5,27 @@ const path = require( 'path' ); // a function definition so we can replace that with local variable definitions we need. function replaceUnneededCode( str ) { + str = str.replace( + /if \( [^)]*node.continueGeneration \)(.|\n|\r)*?}[\r|\n]/mg, + match => { + + if ( match.indexOf( '/* skip */' ) !== - 1 ) { + + return ''; + + } else { + + return 'let stride2Offset = stride4Offset * 2, ' + + 'float32Array = _float32Array, ' + + 'uint16Array = _uint16Array, ' + + 'uint32Array = _uint32Array;\n'; + + } + + } + + ); + str = str.replace( /function intersectRay\((.|[\r\n])*?}[\r|\n]/mg, '' ); str = str.replace( /import { arrayToBox.*?;[\r\n]/g, '' ); @@ -131,20 +152,6 @@ function replaceFunctionNames( str ) { } ); - str = str.replace( - new RegExp( `\n(.+?)${ orNames }.+? {`, 'gm' ), - match => { - - const whitespace = match.match( /^\s+/ )[ 0 ]; - return match + '\n' + whitespace + '\t' + - 'let stride2Offset = stride4Offset * 2, ' + - 'float32Array = _float32Array, ' + - 'uint16Array = _uint16Array, ' + - 'uint32Array = _uint32Array;\n'; - - } - ); - return str; } diff --git a/src/castFunctionsBuffer.js b/src/castFunctionsBuffer.js index 4b4d3fdbd..e50195511 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctionsBuffer.js @@ -118,8 +118,6 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { export const shapecastBuffer = ( function () { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const _triangle = new SeparatingAxisTriangle(); const _cachedBox1 = new Box3(); const _cachedBox2 = new Box3(); @@ -194,6 +192,8 @@ export const shapecastBuffer = ( function () { } + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); if ( isLeaf && intersectsTriangleFunc ) { @@ -327,8 +327,6 @@ export const shapecastBuffer = ( function () { export const intersectsGeometryBuffer = ( function () { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const triangle = new SeparatingAxisTriangle(); const triangle2 = new SeparatingAxisTriangle(); const cachedMesh = new Mesh(); From f4ba4225bcb459895fa3b93c8634cb0bc988c239 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 19:22:24 -0800 Subject: [PATCH 017/139] fix buffer functions --- scripts/generate-cast-functions.js | 2 +- src/castFunctions.js | 8 ++++++++ src/castFunctionsBuffer.js | 9 ++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index 6d27eb3aa..f7f626199 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -6,7 +6,7 @@ const path = require( 'path' ); function replaceUnneededCode( str ) { str = str.replace( - /if \( [^)]*node.continueGeneration \)(.|\n|\r)*?}[\r|\n]/mg, + /\/\* INSERT_BUFFER_VARS \*\//mg, match => { if ( match.indexOf( '/* skip */' ) !== - 1 ) { diff --git a/src/castFunctions.js b/src/castFunctions.js index 9efd3aa89..44508da61 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -21,6 +21,8 @@ function intersectRay( node, ray, target ) { export function raycast( node, mesh, raycaster, ray, intersects ) { + /* INSERT_BUFFER_VARS */ + const isLeaf = ! ! node.count; if ( isLeaf ) { @@ -46,6 +48,8 @@ export function raycast( node, mesh, raycaster, ray, intersects ) { export function raycastFirst( node, mesh, raycaster, ray ) { + /* INSERT_BUFFER_VARS */ + const isLeaf = ! ! node.count; if ( isLeaf ) { @@ -162,6 +166,8 @@ export const shapecast = ( function () { cachedBox2 = _cachedBox2 ) { + /* INSERT_BUFFER_VARS */ + // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents function getLeftOffset( node ) { @@ -331,6 +337,8 @@ export const intersectsGeometry = ( function () { return function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) { + /* INSERT_BUFFER_VARS */ + if ( cachedObb === null ) { if ( ! geometry.boundingBox ) { diff --git a/src/castFunctionsBuffer.js b/src/castFunctionsBuffer.js index e50195511..2fdf81f09 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctionsBuffer.js @@ -7,7 +7,6 @@ import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; - import { OrientedBox } from './Utils/OrientedBox.js'; import { setTriangle } from './Utils/TriangleUtils.js'; import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; @@ -162,12 +161,12 @@ export const shapecastBuffer = ( function () { cachedBox2 = _cachedBox2 ) { + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents function getLeftOffsetBuffer( stride4Offset ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { /* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2; @@ -180,8 +179,6 @@ export const shapecastBuffer = ( function () { function getRightEndOffsetBuffer( stride4Offset ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { /* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2; @@ -192,8 +189,6 @@ export const shapecastBuffer = ( function () { } - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); if ( isLeaf && intersectsTriangleFunc ) { From 3b11703830a419cea3e5e85f66e22460979f82a5 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 19:24:19 -0800 Subject: [PATCH 018/139] fix configs --- babel.config.js => babel.config.json | 4 ++-- jest.config.js | 4 ---- jest.config.json | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-) rename babel.config.js => babel.config.json (62%) delete mode 100644 jest.config.js create mode 100644 jest.config.json diff --git a/babel.config.js b/babel.config.json similarity index 62% rename from babel.config.js rename to babel.config.json index f85ad4fb6..91d4cc74e 100644 --- a/babel.config.js +++ b/babel.config.json @@ -1,3 +1,3 @@ -module.exports = { +{ "presets": [ "@babel/preset-env" ] -}; +} diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index dbab266e2..000000000 --- a/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - verbose: true, - transformIgnorePatterns: [] -}; diff --git a/jest.config.json b/jest.config.json new file mode 100644 index 000000000..e5de9755e --- /dev/null +++ b/jest.config.json @@ -0,0 +1,4 @@ +{ + "verbose": true, + "transformIgnorePatterns": [] +} From a13662b4d7eae0b0d7742566aca12da70abd10b3 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 20:20:17 -0800 Subject: [PATCH 019/139] Update README.md --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 7eb71c064..1c503be7d 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ geometry.boundsTree = deserializedBVH; ## Asynchronous Generation +_NOTE WebWorker syntax is inconsistently supported across bundlers and sometimes not supported at all so the GenereateMeshBVHWorker class is not exported from the package root. If needed the code from `src/worker` can be copied and modified to accomodate a particular build process._ + ```js import { GenerateMeshBVHWorker } from 'three-mesh-bvh/src/workers/GenerateMeshBVHWorker.js'; @@ -452,6 +454,36 @@ If the raycaster object being used has a property `firstHitOnly` set to `true`, THREE.Mesh.prototype.raycast = acceleratedRaycast; ``` +## GenerateMeshBVHWorker + +Helper class for generating a MeshBVH for a given geometry in asynchronously in a worker. The geometry position and index buffer attribute `ArrayBuffers` are transferred to the Worker while the BVH is being generated meaning the geometry will be unavailable to use while the BVH is being processed unless `SharedArrayBuffers` are used. They will be automatically replaced when the MeshBVH is finished generating. + +_NOTE It's best to reuse a single instance of this class to avoid the overhead of instantiating a new Worker._ + +### .running + +```js +running : Boolean; +``` + +Flag indicating whether or not a BVH is already being generated in the worker. + +### .generate + +```js +generate( geometry : BufferGeometry, options : Object ) : Promise< MeshBVH >; +``` + +Generates a MeshBVH instance for the given geometry with the given options in a WebWorker. Returns a promise that resolves with the generated MeshBVH. This function will throw an error if it is already running. + +### .terminate + +```js +terminate() : Boolean; +``` + +Terminates the worker. + ## Debug Functions ### estimateMemoryInBytes From 65cc923547db3f47d4fe37d98f47a383bf3779e6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 20:25:12 -0800 Subject: [PATCH 020/139] Remove lazyGeneration flags from tests --- test/MeshBVH.test.js | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/MeshBVH.test.js b/test/MeshBVH.test.js index d7b516df9..811494534 100644 --- a/test/MeshBVH.test.js +++ b/test/MeshBVH.test.js @@ -28,7 +28,7 @@ describe( 'Bounds Tree', () => { it( 'should properly encapsulate all triangles and bounds.', () => { const geom = new SphereBufferGeometry( 500, 50, 50 ); - const bvh = new MeshBVH( geom, { lazyGeneration: false } ); + const bvh = new MeshBVH( geom ); const debug = new MeshBVHDebug( bvh, geom ); expect( debug.validateBounds() ).toBeTruthy(); @@ -183,7 +183,7 @@ describe( 'Serialization', () => { it( 'should serialize then deserialize to the same structure.', () => { const geom = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom, { packData: true, lazyGeneration: false } ); + const bvh = new MeshBVH( geom, { packData: true } ); const serialized = MeshBVH.serialize( bvh, geom ); const deserializedBVH = MeshBVH.deserialize( serialized, geom ); @@ -194,7 +194,7 @@ describe( 'Serialization', () => { it( 'should copy the index buffer from the target geometry unless copyIndex is set to false', () => { const geom = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom, { packData: true, lazyGeneration: false } ); + const bvh = new MeshBVH( geom, { packData: true } ); expect( geom.index.array ).not.toBe( MeshBVH.serialize( bvh, geom ).index ); expect( geom.index.array ).toBe( MeshBVH.serialize( bvh, geom, false ).index ); @@ -205,7 +205,7 @@ describe( 'Serialization', () => { const geom1 = new SphereBufferGeometry( 1, 10, 10 ); const geom2 = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom1, { packData: true, lazyGeneration: false } ); + const bvh = new MeshBVH( geom1, { packData: true } ); const serialized = MeshBVH.serialize( bvh, geom1 ); expect( geom2.index.array ).not.toBe( serialized.index ); @@ -221,22 +221,22 @@ describe( 'Serialization', () => { } ); - it( 'should complete the tree and then deserialize to packed buffer data if original tree is lazily constructed.', () => { + // it( 'should complete the tree and then deserialize to packed buffer data if original tree is lazily constructed.', () => { - const geom = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom, { packData: false, lazyGeneration: true } ); + // const geom = new SphereBufferGeometry( 1, 10, 10 ); + // const bvh = new MeshBVH( geom, { packData: false, lazyGeneration: true } ); - expect( getMaxDepth( bvh ) ).toBe( 0 ); + // expect( getMaxDepth( bvh ) ).toBe( 0 ); - const serialized = MeshBVH.serialize( bvh, geom ); + // const serialized = MeshBVH.serialize( bvh, geom ); - expect( getMaxDepth( bvh ) ).toBeGreaterThan( 0 ); + // expect( getMaxDepth( bvh ) ).toBeGreaterThan( 0 ); - const deserializedBVH = MeshBVH.deserialize( serialized, geom ); - expect( deserializedBVH._isPacked ).toBeTruthy(); - expect( deserializedBVH._roots[ 0 ] instanceof ArrayBuffer ).toBeTruthy(); + // const deserializedBVH = MeshBVH.deserialize( serialized, geom ); + // expect( deserializedBVH._isPacked ).toBeTruthy(); + // expect( deserializedBVH._roots[ 0 ] instanceof ArrayBuffer ).toBeTruthy(); - } ); + // } ); it( 'should create a new index if one does not exist when deserializing', () => { @@ -268,7 +268,7 @@ describe( 'Options', () => { it( 'should not be limited by default', () => { - mesh.geometry.computeBoundsTree( { lazyGeneration: false } ); + mesh.geometry.computeBoundsTree(); const depth = getMaxDepth( mesh.geometry.boundsTree ); expect( depth ).toBeGreaterThan( 10 ); @@ -277,7 +277,7 @@ describe( 'Options', () => { it( 'should cap the depth of the bounds tree', () => { - mesh.geometry.computeBoundsTree( { maxDepth: 10, verbose: false, lazyGeneration: false } ); + mesh.geometry.computeBoundsTree( { maxDepth: 10, verbose: false } ); const depth = getMaxDepth( mesh.geometry.boundsTree ); expect( depth ).toEqual( 10 ); @@ -308,9 +308,9 @@ describe( 'Options', () => { describe( 'packData & lazyGeneration', () => { - it( 'should be constructed to array buffers if packData is true and lazyGeneration is false.', () => { + it( 'should be constructed to array buffers if packData is true', () => { - mesh.geometry.computeBoundsTree( { packData: true, lazyGeneration: false } ); + mesh.geometry.computeBoundsTree( { packData: true } ); const bvh = mesh.geometry.boundsTree; expect( bvh._isPacked ).toBeTruthy(); @@ -319,9 +319,9 @@ describe( 'Options', () => { } ); - it( 'should be fully constructed as nodes if packData and lazyGeneration are false.', () => { + it( 'should be fully constructed as nodes if packData is false.', () => { - mesh.geometry.computeBoundsTree( { packData: false, lazyGeneration: false } ); + mesh.geometry.computeBoundsTree( { packData: false } ); const bvh = mesh.geometry.boundsTree; expect( bvh._isPacked ).toBeFalsy(); @@ -330,16 +330,16 @@ describe( 'Options', () => { } ); - it( 'should be partially constructed as nodes if packData is false and lazyGeneration is true.', () => { + // it( 'should be partially constructed as nodes if packData is false and lazyGeneration is true.', () => { - mesh.geometry.computeBoundsTree( { packData: false, lazyGeneration: true } ); + // mesh.geometry.computeBoundsTree( { packData: false, lazyGeneration: true } ); - const bvh = mesh.geometry.boundsTree; - expect( bvh._isPacked ).toBeFalsy(); - expect( bvh._roots[ 0 ] instanceof ArrayBuffer ).toBeFalsy(); - expect( getMaxDepth( bvh ) ).toBe( 0 ); + // const bvh = mesh.geometry.boundsTree; + // expect( bvh._isPacked ).toBeFalsy(); + // expect( bvh._roots[ 0 ] instanceof ArrayBuffer ).toBeFalsy(); + // expect( getMaxDepth( bvh ) ).toBe( 0 ); - } ); + // } ); } ); From 6abc8dee9ad93c6fadc99a162cbfd09d7f59a15e Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 20:25:52 -0800 Subject: [PATCH 021/139] remove obsolete tests --- test/MeshBVH.test.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/test/MeshBVH.test.js b/test/MeshBVH.test.js index 811494534..ab03f2263 100644 --- a/test/MeshBVH.test.js +++ b/test/MeshBVH.test.js @@ -221,23 +221,6 @@ describe( 'Serialization', () => { } ); - // it( 'should complete the tree and then deserialize to packed buffer data if original tree is lazily constructed.', () => { - - // const geom = new SphereBufferGeometry( 1, 10, 10 ); - // const bvh = new MeshBVH( geom, { packData: false, lazyGeneration: true } ); - - // expect( getMaxDepth( bvh ) ).toBe( 0 ); - - // const serialized = MeshBVH.serialize( bvh, geom ); - - // expect( getMaxDepth( bvh ) ).toBeGreaterThan( 0 ); - - // const deserializedBVH = MeshBVH.deserialize( serialized, geom ); - // expect( deserializedBVH._isPacked ).toBeTruthy(); - // expect( deserializedBVH._roots[ 0 ] instanceof ArrayBuffer ).toBeTruthy(); - - // } ); - it( 'should create a new index if one does not exist when deserializing', () => { const geom = new SphereBufferGeometry( 1, 10, 10 ); @@ -306,7 +289,7 @@ describe( 'Options', () => { } ); - describe( 'packData & lazyGeneration', () => { + describe( 'packData', () => { it( 'should be constructed to array buffers if packData is true', () => { @@ -330,17 +313,6 @@ describe( 'Options', () => { } ); - // it( 'should be partially constructed as nodes if packData is false and lazyGeneration is true.', () => { - - // mesh.geometry.computeBoundsTree( { packData: false, lazyGeneration: true } ); - - // const bvh = mesh.geometry.boundsTree; - // expect( bvh._isPacked ).toBeFalsy(); - // expect( bvh._roots[ 0 ] instanceof ArrayBuffer ).toBeFalsy(); - // expect( getMaxDepth( bvh ) ).toBe( 0 ); - - // } ); - } ); describe( 'strategy', () => { From 785f9913fe0d4c43811762485f06f787f44b45ac Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 20:27:58 -0800 Subject: [PATCH 022/139] Remove more lazyGeneration references from tests --- test/RandomRaycasts.test.js | 18 ++++++------------ test/RandomRaycastsRepro.test.js | 9 +++------ test/ShapeCasts.test.js | 7 ++----- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/test/RandomRaycasts.test.js b/test/RandomRaycasts.test.js index bf8cc2be2..48ff9fadc 100644 --- a/test/RandomRaycasts.test.js +++ b/test/RandomRaycasts.test.js @@ -99,9 +99,6 @@ function runRandomTests( options ) { raycaster.firstHitOnly = true; const firstHit = raycaster.intersectObject( scene, true ); - // run the og hits _after_ because in the lazy generation case - // the indices will be changing as the tree is generated and make - // the results will look different. ungroupedGeometry.boundsTree = null; groupedGeometry.boundsTree = null; const ogHits = raycaster.intersectObject( scene, true ); @@ -119,24 +116,21 @@ function runRandomTests( options ) { describe( 'Random CENTER intersections', () => { - describe( 'split', () => runRandomTests( { strategy: CENTER, packData: false, lazyGeneration: false } ) ); - describe( 'Lazy split', () => runRandomTests( { strategy: CENTER, packData: false, lazyGeneration: true } ) ); - describe( 'Packed split', () => runRandomTests( { strategy: CENTER, packData: true, lazyGeneration: false } ) ); + describe( 'split', () => runRandomTests( { strategy: CENTER, packData: false } ) ); + describe( 'Packed split', () => runRandomTests( { strategy: CENTER, packData: true } ) ); } ); describe( 'Random AVERAGE intersections', () => { - describe( 'split', () => runRandomTests( { strategy: AVERAGE, packData: false, lazyGeneration: false } ) ); - describe( 'Lazy split', () => runRandomTests( { strategy: AVERAGE, packData: false, lazyGeneration: true } ) ); - describe( 'Packed split', () => runRandomTests( { strategy: AVERAGE, packData: true, lazyGeneration: false } ) ); + describe( 'split', () => runRandomTests( { strategy: AVERAGE, packData: false } ) ); + describe( 'Packed split', () => runRandomTests( { strategy: AVERAGE, packData: true } ) ); } ); describe( 'Random SAH intersections', () => { - describe( 'split', () => runRandomTests( { strategy: SAH, packData: false, lazyGeneration: false } ) ); - describe( 'Lazy split', () => runRandomTests( { strategy: SAH, packData: false, lazyGeneration: true } ) ); - describe( 'Packed split', () => runRandomTests( { strategy: SAH, packData: true, lazyGeneration: false } ) ); + describe( 'split', () => runRandomTests( { strategy: SAH, packData: false } ) ); + describe( 'Packed split', () => runRandomTests( { strategy: SAH, packData: true } ) ); } ); diff --git a/test/RandomRaycastsRepro.test.js b/test/RandomRaycastsRepro.test.js index b9e37c72e..eb8854772 100644 --- a/test/RandomRaycastsRepro.test.js +++ b/test/RandomRaycastsRepro.test.js @@ -95,9 +95,6 @@ function runRandomTest( options, transformSeed, raySeed ) { raycaster.firstHitOnly = true; const firstHit = raycaster.intersectObject( scene, true ); - // run the og hits _after_ because in the lazy generation case - // the indices will be changing as the tree is generated and make - // the results will look different. ungroupedGeometry.boundsTree = null; groupedGeometry.boundsTree = null; const ogHits = raycaster.intersectObject( scene, true ); @@ -112,6 +109,6 @@ function runRandomTest( options, transformSeed, raySeed ) { } -runRandomTest( { strategy: AVERAGE, packData: true, lazyGeneration: false }, 7830035629, 4697211981 ); -runRandomTest( { strategy: AVERAGE, packData: true, lazyGeneration: false }, 8294928772, 1592666709 ); -runRandomTest( { strategy: SAH, packData: true, lazyGeneration: false }, 81992501, 8903271423 ); +runRandomTest( { strategy: AVERAGE, packData: true }, 7830035629, 4697211981 ); +runRandomTest( { strategy: AVERAGE, packData: true }, 8294928772, 1592666709 ); +runRandomTest( { strategy: SAH, packData: true }, 81992501, 8903271423 ); diff --git a/test/ShapeCasts.test.js b/test/ShapeCasts.test.js index 62f2d2b32..1cc9ac78d 100644 --- a/test/ShapeCasts.test.js +++ b/test/ShapeCasts.test.js @@ -30,9 +30,8 @@ BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; describe( 'Shape Casts', () => { - describe( 'lazy: true, packed: false', () => runSuiteWithOptions( { lazyGeneration: true, packedData: false } ) ); - describe( 'lazy: false, packed: false', () => runSuiteWithOptions( { lazyGeneration: false, packedData: false } ) ); - describe( 'lazy: false, packed: true', () => runSuiteWithOptions( { lazyGeneration: false, packedData: true } ) ); + describe( 'packed: false', () => runSuiteWithOptions( { packedData: false } ) ); + describe( 'packed: true', () => runSuiteWithOptions( { packedData: true } ) ); } ); @@ -650,8 +649,6 @@ function runSuiteWithOptions( defaultOptions ) { const bvh = new MeshBVH( geometry ); - // Run the bvh raycast before the builtin raycast because the bvh - // lazy raycast will rearrange the index. geometry.boundsTree = bvh; raycaster.firstHitOnly = true; const bvhHits = raycaster.intersectObject( mesh, true ); From 4810c6bcdd3ecbdb6e570ff1ea8c69a41574cbfc Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 20:33:11 -0800 Subject: [PATCH 023/139] Fix buffer functions --- src/castFunctions.js | 8 ++++++-- src/castFunctionsBuffer.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/castFunctions.js b/src/castFunctions.js index 44508da61..f863e321a 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -166,12 +166,12 @@ export const shapecast = ( function () { cachedBox2 = _cachedBox2 ) { - /* INSERT_BUFFER_VARS */ - // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents function getLeftOffset( node ) { + /* INSERT_BUFFER_VARS */ + while ( ! node.count ) { node = node.left; @@ -184,6 +184,8 @@ export const shapecast = ( function () { function getRightEndOffset( node ) { + /* INSERT_BUFFER_VARS */ + while ( ! node.count ) { node = node.right; @@ -194,6 +196,8 @@ export const shapecast = ( function () { } + /* INSERT_BUFFER_VARS */ + const isLeaf = ! ! node.count; if ( isLeaf && intersectsTriangleFunc ) { diff --git a/src/castFunctionsBuffer.js b/src/castFunctionsBuffer.js index 2fdf81f09..8dcc88d19 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctionsBuffer.js @@ -161,12 +161,12 @@ export const shapecastBuffer = ( function () { cachedBox2 = _cachedBox2 ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents function getLeftOffsetBuffer( stride4Offset ) { + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { /* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2; @@ -179,6 +179,8 @@ export const shapecastBuffer = ( function () { function getRightEndOffsetBuffer( stride4Offset ) { + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { /* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2; @@ -189,6 +191,8 @@ export const shapecastBuffer = ( function () { } + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); if ( isLeaf && intersectsTriangleFunc ) { From 3b15327153a533e10f229b11fbebfd045406552a Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:06:44 -0800 Subject: [PATCH 024/139] Update benchmark --- benchmark/run-benchmark.js | 31 +++++++++++++------------------ src/castFunctionsBuffer.js | 1 + 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index c4a109f40..f20bdf833 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -42,11 +42,9 @@ function logExtremes( bvh, geometry ) { } -function runSuite( strategy, lazyGeneration = true ) { - - const options = { lazyGeneration, strategy }; - let preFunc = lazyGeneration ? () => geometry.computeBoundsTree( options ) : null; +function runSuite( strategy ) { + const options = { strategy }; geometry.computeBoundsTree( options ); logExtremes( geometry.boundsTree, geometry ); @@ -69,7 +67,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'Serialize', - preFunc, + null, () => { MeshBVH.serialize( geometry.boundsTree, geometry ); @@ -84,7 +82,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'Deserialize', - preFunc, + null, () => { MeshBVH.deserialize( serialized, geometry ); @@ -100,7 +98,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'BVH Raycast', - preFunc, + null, () => mesh.raycast( raycaster, [] ), 3000 @@ -110,7 +108,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'First Hit Raycast', - preFunc, + null, () => mesh.raycast( raycaster, [] ), 3000 @@ -119,7 +117,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'Sphere Shapecast', - preFunc, + null, () => { mesh.geometry.boundsTree.shapecast( mesh, box => sphere.intersectsBox( box ), tri => { @@ -136,7 +134,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'IntersectsSphere', - preFunc, + null, () => mesh.geometry.boundsTree.intersectsSphere( mesh, sphere ), 3000 @@ -145,7 +143,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'IntersectsBox', - preFunc, + null, () => mesh.geometry.boundsTree.intersectsBox( mesh, box, boxMat ), 3000 @@ -154,7 +152,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'DistanceToGeometry', - preFunc, + null, () => mesh.geometry.boundsTree.closestPointToGeometry( mesh, intersectGeometry, geomMat, target1, target2 ), 3000 @@ -164,7 +162,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'DistanceToPoint', - preFunc, + null, () => mesh.geometry.boundsTree.closestPointToPoint( mesh, vec, target1 ), 3000 @@ -176,7 +174,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'IntersectsGeometry with BVH', - preFunc, + null, () => mesh.geometry.boundsTree.intersectsGeometry( mesh, intersectGeometry, geomMat ), 3000 @@ -187,7 +185,7 @@ function runSuite( strategy, lazyGeneration = true ) { runBenchmark( 'IntersectsGeometry without BVH', - preFunc, + null, () => mesh.geometry.boundsTree.intersectsGeometry( mesh, intersectGeometry, geomMat ), 3000 @@ -199,9 +197,6 @@ function runSuite( strategy, lazyGeneration = true ) { console.log( '*Strategy: CENTER*' ); runSuite( CENTER ); -console.log( '' ); -console.log( '*Strategy: Non-Lazy CENTER*' ); -runSuite( CENTER, false ); console.log( '' ); console.log( '*Strategy: AVERAGE*' ); diff --git a/src/castFunctionsBuffer.js b/src/castFunctionsBuffer.js index 8dcc88d19..e50195511 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctionsBuffer.js @@ -7,6 +7,7 @@ import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; + import { OrientedBox } from './Utils/OrientedBox.js'; import { setTriangle } from './Utils/TriangleUtils.js'; import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; From a67e0e9ab21aff7280d66cd01d50c7d660481a23 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:34:14 -0800 Subject: [PATCH 025/139] Remove support for the non packed bvh option --- src/MeshBVH.js | 149 +++----------- src/castFunctions.js | 466 ------------------------------------------- 2 files changed, 33 insertions(+), 582 deletions(-) delete mode 100644 src/castFunctions.js diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 681e6e70d..47e2c3095 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -4,13 +4,6 @@ import { buildTree } from './buildFunctions.js'; import { OrientedBox } from './Utils/OrientedBox.js'; import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; import { setTriangle } from './Utils/TriangleUtils.js'; -import { - raycast, - raycastFirst, - shapecast, - intersectsGeometry, -} from './castFunctions.js'; - import { raycastBuffer, raycastFirstBuffer, @@ -136,7 +129,6 @@ export default class MeshBVH { const { index, roots } = data; const bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } ); bvh._roots = roots; - bvh._isPacked = true; if ( setIndex ) { @@ -185,26 +177,18 @@ export default class MeshBVH { // undocumented options - // whether to the pack the data as a buffer or not. - packData: true, - // Whether to skip generating the tree. Used for deserialization. [ SKIP_GENERATION ]: false }, options ); options.strategy = Math.max( 0, Math.min( 2, options.strategy ) ); - this._isPacked = false; this._roots = null; if ( ! options[ SKIP_GENERATION ] ) { + // TODO: separate the buffer packing from the serialize function this._roots = buildTree( geo, options ); - if ( options.packData ) { - - this._roots = MeshBVH.serialize( this, geo, false ).roots; - this._isPacked = true; - - } + this._roots = MeshBVH.serialize( this, geo, false ).roots; } @@ -212,62 +196,32 @@ export default class MeshBVH { traverse( callback, rootIndex = 0 ) { - if ( this._isPacked ) { - - const buffer = this._roots[ rootIndex ]; - const uint32Array = new Uint32Array( buffer ); - const uint16Array = new Uint16Array( buffer ); - _traverseBuffer( 0 ); - - function _traverseBuffer( stride4Offset, depth = 0 ) { - - const stride2Offset = stride4Offset * 2; - const isLeaf = uint16Array[ stride2Offset + 15 ]; - if ( isLeaf ) { - - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; - callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count ); - - } else { - - const left = stride4Offset + BYTES_PER_NODE / 4; - const right = uint32Array[ stride4Offset + 6 ]; - const splitAxis = uint32Array[ stride4Offset + 7 ]; - const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis ); - - if ( ! stopTraversal ) { + const buffer = this._roots[ rootIndex ]; + const uint32Array = new Uint32Array( buffer ); + const uint16Array = new Uint16Array( buffer ); + _traverseBuffer( 0 ); - _traverseBuffer( left, depth + 1 ); - _traverseBuffer( right, depth + 1 ); + function _traverseBuffer( stride4Offset, depth = 0 ) { - } - - } - - } - - } else { - - _traverseNode( this._roots[ rootIndex ] ); - - function _traverseNode( node, depth = 0 ) { - - const isLeaf = ! ! node.count; - if ( isLeaf ) { - - callback( depth, isLeaf, node.boundingData, node.offset, node.count ); + const stride2Offset = stride4Offset * 2; + const isLeaf = uint16Array[ stride2Offset + 15 ]; + if ( isLeaf ) { - } else { + const offset = uint32Array[ stride4Offset + 6 ]; + const count = uint16Array[ stride2Offset + 14 ]; + callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count ); - const stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis ); + } else { - if ( ! stopTraversal ) { + const left = stride4Offset + BYTES_PER_NODE / 4; + const right = uint32Array[ stride4Offset + 6 ]; + const splitAxis = uint32Array[ stride4Offset + 7 ]; + const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis ); - if ( node.left ) _traverseNode( node.left, depth + 1 ); - if ( node.right ) _traverseNode( node.right, depth + 1 ); + if ( ! stopTraversal ) { - } + _traverseBuffer( left, depth + 1 ); + _traverseBuffer( right, depth + 1 ); } @@ -280,43 +234,24 @@ export default class MeshBVH { /* Core Cast Functions */ raycast( mesh, raycaster, ray, intersects ) { - const isPacked = this._isPacked; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - raycastBuffer( 0, mesh, raycaster, ray, intersects ); - - } else { - - raycast( root, mesh, raycaster, ray, intersects ); - - } + setBuffer( root ); + raycastBuffer( 0, mesh, raycaster, ray, intersects ); } - isPacked && clearBuffer(); + clearBuffer(); } raycastFirst( mesh, raycaster, ray ) { - const isPacked = this._isPacked; let closestResult = null; for ( const root of this._roots ) { - let result; - if ( isPacked ) { - - setBuffer( root ); - result = raycastFirstBuffer( 0, mesh, raycaster, ray ); - - } else { - - result = raycastFirst( root, mesh, raycaster, ray ); - - } + setBuffer( root ); + const result = raycastFirstBuffer( 0, mesh, raycaster, ray ); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -326,7 +261,7 @@ export default class MeshBVH { } - isPacked && clearBuffer(); + clearBuffer(); return closestResult; @@ -334,20 +269,11 @@ export default class MeshBVH { intersectsGeometry( mesh, geometry, geomToMesh ) { - const isPacked = this._isPacked; let result = false; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - result = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh ); - - } else { - - result = intersectsGeometry( root, mesh, geometry, geomToMesh ); - - } + setBuffer( root ); + result = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh ); if ( result ) { @@ -357,7 +283,7 @@ export default class MeshBVH { } - isPacked && clearBuffer(); + clearBuffer(); return result; @@ -365,20 +291,11 @@ export default class MeshBVH { shapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) { - const isPacked = this._isPacked; let result = false; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - result = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); - - } else { - - result = shapecast( root, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); - - } + setBuffer( root ); + result = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); if ( result ) { @@ -388,7 +305,7 @@ export default class MeshBVH { } - isPacked && clearBuffer(); + clearBuffer(); return result; diff --git a/src/castFunctions.js b/src/castFunctions.js deleted file mode 100644 index f863e321a..000000000 --- a/src/castFunctions.js +++ /dev/null @@ -1,466 +0,0 @@ - -import { Box3, Vector3, Mesh, Matrix4 } from 'three'; -import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; -import { arrayToBox } from './Utils/ArrayBoxUtilities.js'; -import { OrientedBox } from './Utils/OrientedBox.js'; -import { setTriangle } from './Utils/TriangleUtils.js'; -import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; -import { CONTAINED } from './Constants.js'; - -const boundingBox = new Box3(); -const boxIntersection = new Vector3(); -const xyzFields = [ 'x', 'y', 'z' ]; - -function intersectRay( node, ray, target ) { - - arrayToBox( node.boundingData, boundingBox ); - - return ray.intersectBox( boundingBox, target ); - -} - -export function raycast( node, mesh, raycaster, ray, intersects ) { - - /* INSERT_BUFFER_VARS */ - - const isLeaf = ! ! node.count; - if ( isLeaf ) { - - intersectTris( mesh, mesh.geometry, raycaster, ray, node.offset, node.count, intersects ); - - } else { - - if ( intersectRay( node.left, ray, boxIntersection ) ) { - - raycast( node.left, mesh, raycaster, ray, intersects ); - - } - - if ( intersectRay( node.right, ray, boxIntersection ) ) { - - raycast( node.right, mesh, raycaster, ray, intersects ); - - } - - } - -} - -export function raycastFirst( node, mesh, raycaster, ray ) { - - /* INSERT_BUFFER_VARS */ - - const isLeaf = ! ! node.count; - if ( isLeaf ) { - - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, node.offset, node.count ); - - } else { - - - // consider the position of the split plane with respect to the oncoming ray; whichever direction - // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = node.splitAxis; - const xyzAxis = xyzFields[ splitAxis ]; - const rayDir = ray.direction[ xyzAxis ]; - const leftToRight = rayDir >= 0; - - // c1 is the child to check first - let c1, c2; - if ( leftToRight ) { - - c1 = node.left; - c2 = node.right; - - } else { - - c1 = node.right; - c2 = node.left; - - } - - const c1Intersection = intersectRay( c1, ray, boxIntersection ); - const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; - - // if we got an intersection in the first node and it's closer than the second node's bounding - // box, we don't need to consider the second node because it couldn't possibly be a better result - if ( c1Result ) { - - // check if the point is within the second bounds - const point = c1Result.point[ xyzAxis ]; - const isOutside = leftToRight ? - point <= c2.boundingData[ splitAxis ] : - point >= c2.boundingData[ splitAxis + 3 ]; - - if ( isOutside ) { - - return c1Result; - - } - - } - - // either there was no intersection in the first node, or there could still be a closer - // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRay( c2, ray, boxIntersection ); - const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; - - if ( c1Result && c2Result ) { - - return c1Result.distance <= c2Result.distance ? c1Result : c2Result; - - } else { - - return c1Result || c2Result || null; - - } - - } - -} - -export const shapecast = ( function () { - - const _triangle = new SeparatingAxisTriangle(); - const _cachedBox1 = new Box3(); - const _cachedBox2 = new Box3(); - - function iterateOverTriangles( - offset, - count, - geometry, - intersectsTriangleFunc, - contained, - depth, - triangle - ) { - - const index = geometry.index; - const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { - - setTriangle( triangle, i, index, pos ); - triangle.needsUpdate = true; - - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { - - return true; - - } - - } - - return false; - - } - - return function shapecast( - node, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc = null, - nodeScoreFunc = null, - depth = 0, - triangle = _triangle, - cachedBox1 = _cachedBox1, - cachedBox2 = _cachedBox2 - ) { - - // Define these inside the function so it has access to the local variables needed - // when converting to the buffer equivalents - function getLeftOffset( node ) { - - /* INSERT_BUFFER_VARS */ - - while ( ! node.count ) { - - node = node.left; - - } - - return node.offset; - - } - - function getRightEndOffset( node ) { - - /* INSERT_BUFFER_VARS */ - - while ( ! node.count ) { - - node = node.right; - - } - - return node.offset + node.count; - - } - - /* INSERT_BUFFER_VARS */ - - const isLeaf = ! ! node.count; - if ( isLeaf && intersectsTriangleFunc ) { - - const geometry = mesh.geometry; - const offset = node.offset; - const count = node.count; - return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); - - } else { - - const left = node.left; - const right = node.right; - let c1 = left; - let c2 = right; - - let score1, score2; - let box1, box2; - if ( nodeScoreFunc ) { - - box1 = cachedBox1; - box2 = cachedBox2; - - arrayToBox( c1.boundingData, box1 ); - arrayToBox( c2.boundingData, box2 ); - - score1 = nodeScoreFunc( box1 ); - score2 = nodeScoreFunc( box2 ); - - if ( score2 < score1 ) { - - c1 = right; - c2 = left; - - const temp = score1; - score1 = score2; - score2 = temp; - - box1 = box2; - // box2 is always set before use below - - } - - } - - // Check box 1 intersection - if ( ! box1 ) { - - box1 = cachedBox1; - arrayToBox( c1.boundingData, box1 ); - - } - - const isC1Leaf = ! ! c1.count; - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); - - let c1StopTraversal; - if ( c1Intersection === CONTAINED ) { - - const geometry = mesh.geometry; - const offset = getLeftOffset( c1 ); - const end = getRightEndOffset( c1 ); - const count = end - offset; - - c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); - - } else { - - c1StopTraversal = - c1Intersection && - shapecast( - c1, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc, - nodeScoreFunc, - depth + 1, - triangle, - cachedBox1, - cachedBox2 - ); - - } - - if ( c1StopTraversal ) return true; - - // Check box 2 intersection - // cached box2 will have been overwritten by previous traversal - box2 = cachedBox2; - arrayToBox( c2.boundingData, box2 ); - - const isC2Leaf = ! ! c2.count; - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); - - let c2StopTraversal; - if ( c2Intersection === CONTAINED ) { - - const geometry = mesh.geometry; - const offset = getLeftOffset( c2 ); - const end = getRightEndOffset( c2 ); - const count = end - offset; - - c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); - - } else { - - c2StopTraversal = - c2Intersection && - shapecast( - c2, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc, - nodeScoreFunc, - depth + 1, - triangle, - cachedBox1, - cachedBox2 - ); - - } - - if ( c2StopTraversal ) return true; - - return false; - - } - - }; - -} )(); - -export const intersectsGeometry = ( function () { - - const triangle = new SeparatingAxisTriangle(); - const triangle2 = new SeparatingAxisTriangle(); - const cachedMesh = new Mesh(); - const invertedMat = new Matrix4(); - - const obb = new OrientedBox(); - const obb2 = new OrientedBox(); - - return function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) { - - /* INSERT_BUFFER_VARS */ - - if ( cachedObb === null ) { - - if ( ! geometry.boundingBox ) { - - geometry.computeBoundingBox(); - - } - - obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); - obb.update(); - cachedObb = obb; - - } - - const isLeaf = ! ! node.count; - if ( isLeaf ) { - - const thisGeometry = mesh.geometry; - const thisIndex = thisGeometry.index; - const thisPos = thisGeometry.attributes.position; - - const index = geometry.index; - const pos = geometry.attributes.position; - - const offset = node.offset; - const count = node.count; - - // get the inverse of the geometry matrix so we can transform our triangles into the - // geometry space we're trying to test. We assume there are fewer triangles being checked - // here. - invertedMat.copy( geometryToBvh ).invert(); - - if ( geometry.boundsTree ) { - - arrayToBox( node.boundingData, obb2 ); - obb2.matrix.copy( invertedMat ); - obb2.update(); - - cachedMesh.geometry = geometry; - const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { - - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); - - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { - - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { - - return true; - - } - - } - - return false; - - } ); - cachedMesh.geometry = null; - - return res; - - } else { - - for ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) { - - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle, i, thisIndex, thisPos ); - triangle.a.applyMatrix4( invertedMat ); - triangle.b.applyMatrix4( invertedMat ); - triangle.c.applyMatrix4( invertedMat ); - triangle.update(); - - for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { - - setTriangle( triangle2, i2, index, pos ); - triangle2.update(); - - if ( triangle.intersectsTriangle( triangle2 ) ) { - - return true; - - } - - } - - } - - } - - } else { - - const left = node.left; - const right = node.right; - - arrayToBox( left.boundingData, boundingBox ); - const leftIntersection = - cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); - - if ( leftIntersection ) return true; - - - arrayToBox( right.boundingData, boundingBox ); - const rightIntersection = - cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); - - if ( rightIntersection ) return true; - - return false; - - } - - }; - -} )(); From eca951403e47042914d8ca1ed5016a79b7c4e359 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:34:46 -0800 Subject: [PATCH 026/139] Remove generate cast function --- package.json | 9 +- scripts/generate-cast-functions.js | 249 ----------------------------- 2 files changed, 4 insertions(+), 254 deletions(-) delete mode 100644 scripts/generate-cast-functions.js diff --git a/package.json b/package.json index 3c32ae4ec..841a2f369 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,10 @@ "type": "module", "scripts": { "start": "concurrently \"parcel watch ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache\" \"rollup -w -c\" \"static-server\"", - "generate-cast-functions": "node ./scripts/generate-cast-functions.js", - "build": "npm run generate-cast-functions && rollup -c & parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", - "test": "npm run generate-cast-functions && jest", - "lint": "npm run generate-cast-functions && eslint \"./src/*.js\" \"./test/*.js\" \"./example/*.js\"", - "benchmark": "npm run generate-cast-functions && node benchmark/run-benchmark.js" + "build": "rollup -c & parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", + "test": "jest", + "lint": "eslint \"./src/*.js\" \"./test/*.js\" \"./example/*.js\"", + "benchmark": "node benchmark/run-benchmark.js" }, "files": [ "src/*", diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js deleted file mode 100644 index 2c0073896..000000000 --- a/scripts/generate-cast-functions.js +++ /dev/null @@ -1,249 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -// Replace unneeded function definitions and checks. The `continueGeneration` block is always at the top of -// a function definition so we can replace that with local variable definitions we need. -function replaceUnneededCode( str ) { - - str = str.replace( - /\/\* INSERT_BUFFER_VARS \*\//mg, - match => { - - if ( match.indexOf( '/* skip */' ) !== - 1 ) { - - return ''; - - } else { - - return 'let stride2Offset = stride4Offset * 2, ' + - 'float32Array = _float32Array, ' + - 'uint16Array = _uint16Array, ' + - 'uint32Array = _uint32Array;\n'; - - } - - } - - ); - - str = str.replace( /function intersectRay\((.|[\r\n])*?}[\r|\n]/mg, '' ); - - str = str.replace( /import { arrayToBox.*?;[\r\n]/g, '' ); - - return str; - -} - -// Replace function calls with buffer variants defined in the added functions. -function replaceFunctionCalls( str ) { - - str = str.replace( /arrayToBox\((.*?),/g, ( match, arg ) => { - - return `arrayToBoxBuffer(${ arg }, float32Array,`; - - } ); - - str = str.replace( /intersectRay\((.*?),/g, ( match, arg ) => { - - return `intersectRayBuffer(${ arg }, float32Array,`; - - } ); - - return str; - -} - -function replaceNodeNames( str ) { - - const convertName = ( name, count = 4 ) => { - - return name === 'node' ? `stride${ count }Offset` : name; - - }; - - const names = 'c1|c2|left|right|node'; - - str = str.replace( - new RegExp( `(${ names })\\.boundingData\\[(.*)\\]\\[(.*)\\]`, 'g' ), - ( match, name, index, index2 ) => `/* ${ name } boundingData */ float32Array[ ${ convertName( name ) } +${ index }+${ index2 }]` - ); - - str = str.replace( - new RegExp( `(${ names })\\.boundingData\\[(.*)\\]`, 'g' ), - ( match, name, index ) => `/* ${ name } boundingData */ float32Array[ ${ convertName( name ) } +${ index }]` - ); - - str = str.replace( - new RegExp( `(${ names })\\.boundingData`, 'g' ), - ( match, name ) => `/* ${ name } boundingData */ ${ convertName( name ) }` - ); - - str = str.replace( - new RegExp( `(${ names })\\.offset`, 'g' ), - ( match, name ) => `/* ${ name } offset */ uint32Array[ ${ convertName( name ) } + 6 ]` - ); - - str = str.replace( - new RegExp( `! (${ names })\\.count`, 'g' ), - ( match, name ) => `/* ${ name } count */ ( uint16Array[ ${ convertName( name, 2 ) } + 15 ] !== 0xffff )` - ); - - str = str.replace( - new RegExp( `(${ names })\\.count`, 'g' ), - ( match, name ) => `/* ${ name } count */ uint16Array[ ${ convertName( name, 2 ) } + 14 ]` - ); - - str = str.replace( - new RegExp( `(${ names })\\.left`, 'g' ), - ( match, name ) => `/* ${ name } left */ ${ convertName( name ) } + 8` - ); - - str = str.replace( - new RegExp( `(${ names })\\.right`, 'g' ), - ( match, name ) => `/* ${ name } right */ uint32Array[ ${ convertName( name ) } + 6 ]` - ); - - str = str.replace( - new RegExp( `(${ names })\\.splitAxis`, 'g' ), - ( match, name ) => `/* ${ name } splitAxis */ uint32Array[ ${ convertName( name ) } + 7 ]` - ); - - str = str.replace( - new RegExp( `(node)\\s*=([^;]*);`, 'g' ), - ( match, name, content ) => { - - return `/* ${ name } */ stride4Offset =${ content }, stride2Offset = stride4Offset * 2;`; - - } - ); - - return str; - -} - -function replaceFunctionNames( str ) { - - const orNames = '\\s(raycast|raycastFirst|shapecast|intersectsGeometry|getLeftOffset|getRightEndOffset)'; - - str = str.replace( - new RegExp( `(${ orNames })\\(([\\s\\r\\n]+)?node`, 'gm' ), - ( match, funcName ) => { - - return `${ funcName }Buffer( stride4Offset`; - - } - ); - - str = str.replace( - new RegExp( `(${ orNames })\\(`, 'gm' ), - ( match, funcName ) => { - - return `${ funcName }Buffer(`; - - } - ); - - str = str.replace( - new RegExp( `const(${ orNames })`, 'gm' ), - ( match, funcName ) => { - - return `const${ funcName }Buffer`; - - } - ); - - return str; - -} - -function addFunctions( str ) { - - str = str + ` - -function intersectRayBuffer( stride4Offset, array, ray, target ) { - - arrayToBoxBuffer( stride4Offset, array, boundingBox ); - return ray.intersectBox( boundingBox, target ); - -} - -const bufferStack = []; -let _prevBuffer; -let _float32Array; -let _uint16Array; -let _uint32Array; -export function setBuffer( buffer ) { - - if ( _prevBuffer ) { - - bufferStack.push( _prevBuffer ); - - } - - _prevBuffer = buffer; - _float32Array = new Float32Array( buffer ); - _uint16Array = new Uint16Array( buffer ); - _uint32Array = new Uint32Array( buffer ); - -} - -export function clearBuffer() { - - _prevBuffer = null; - _float32Array = null; - _uint16Array = null; - _uint32Array = null; - - if ( bufferStack.length ) { - - setBuffer( bufferStack.pop() ); - - } - -} - -function arrayToBoxBuffer( stride4Offset, array, target ) { - - target.min.x = array[ stride4Offset ]; - target.min.y = array[ stride4Offset + 1 ]; - target.min.z = array[ stride4Offset + 2 ]; - - target.max.x = array[ stride4Offset + 3 ]; - target.max.y = array[ stride4Offset + 4 ]; - target.max.z = array[ stride4Offset + 5 ]; - -} -`; - - return str; - -} - -function addHeaderComment( str ) { - - str = ` -/************************************************************************************************** - * - * This file is generated from castFunctions.js and scripts/generate-cast-function.mjs. Do not edit. - * - *************************************************************************************************/ -` + str; - - return str; - -} - -const templatePath = path.resolve( './src/castFunctions.js' ); -const bufferFilePath = path.resolve( './src/castFunctionsBuffer.js' ); -const str = fs.readFileSync( templatePath, { encoding: 'utf8' } ); - -let result = str; -result = replaceUnneededCode( result ); -result = replaceFunctionCalls( result ); -result = replaceNodeNames( result ); -result = replaceFunctionNames( result ); -result = addFunctions( result ); -result = addHeaderComment( result ); -result = result.replace( /^[ \t]+$/gm, '' ); -result = result.replace( /[\n\r]{3,}/g, '\n\n' ); -fs.writeFileSync( bufferFilePath, result ); From c38fbc93b3c3c785d27219f8a8fa9c310a1e7ec4 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:37:24 -0800 Subject: [PATCH 027/139] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a640d31e..b3ac3fdb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. - Use `type: module` in package.json to enable use of es6 modules in node. +- Remove ability to generate an unpacked BVH. ## [0.3.5] - 2021-02-28 ### Fixed From ab0381fa1e2af2a25a8c95412f09c2685255aaef Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:37:48 -0800 Subject: [PATCH 028/139] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 219bd4fc6..08baa3456 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; THREE.Mesh.prototype.raycast = acceleratedRaycast; // Generate geometry and associated BVH -const geom = new THREE.TorusKnotBufferGeometry(10, 3, 400, 100); -const mesh = new THREE.Mesh(geom, material); +const geom = new THREE.TorusKnotBufferGeometry( 10, 3, 400, 100 ); +const mesh = new THREE.Mesh( geom, material ); geom.computeBoundsTree(); ``` From 23bc84e490a4d766c30e5a387793fe41bc2f6131 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:57:01 -0800 Subject: [PATCH 029/139] Separate buffer packing logic --- src/MeshBVH.js | 98 ++----------------------------------------- src/buildFunctions.js | 87 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 94 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 47e2c3095..d3831a003 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -1,6 +1,6 @@ import { Vector3, BufferAttribute } from 'three'; import { CENTER } from './Constants.js'; -import { buildTree } from './buildFunctions.js'; +import { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js'; import { OrientedBox } from './Utils/OrientedBox.js'; import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; import { setTriangle } from './Utils/TriangleUtils.js'; @@ -13,11 +13,6 @@ import { clearBuffer, } from './castFunctionsBuffer.js'; -// boundingData : 6 float32 -// right / offset : 1 uint32 -// splitAxis / isLeaf + count : 1 uint32 / 2 uint16 -const BYTES_PER_NODE = 6 * 4 + 4 + 4; -const IS_LEAFNODE_FLAG = 0xFFFF; const SKIP_GENERATION = Symbol( 'skip tree generation' ); const obb = new OrientedBox(); @@ -30,90 +25,7 @@ export default class MeshBVH { static serialize( bvh, geometry, copyIndexBuffer = true ) { - function countNodes( node ) { - - if ( node.count ) { - - return 1; - - } else { - - return 1 + countNodes( node.left ) + countNodes( node.right ); - - } - - } - - function populateBuffer( byteOffset, node ) { - - const stride4Offset = byteOffset / 4; - const stride2Offset = byteOffset / 2; - const isLeaf = ! ! node.count; - const boundingData = node.boundingData; - for ( let i = 0; i < 6; i ++ ) { - - float32Array[ stride4Offset + i ] = boundingData[ i ]; - - } - - if ( isLeaf ) { - - const offset = node.offset; - const count = node.count; - uint32Array[ stride4Offset + 6 ] = offset; - uint16Array[ stride2Offset + 14 ] = count; - uint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG; - return byteOffset + BYTES_PER_NODE; - - } else { - - const left = node.left; - const right = node.right; - const splitAxis = node.splitAxis; - - let nextUnusedPointer; - nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); - - uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; - nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); - - uint32Array[ stride4Offset + 7 ] = splitAxis; - return nextUnusedPointer; - - } - - } - - let float32Array; - let uint32Array; - let uint16Array; - - const roots = bvh._roots; - let rootData; - - if ( bvh._isPacked ) { - - rootData = roots; - - } else { - - rootData = []; - for ( let i = 0; i < roots.length; i ++ ) { - - const root = roots[ i ]; - let nodeCount = countNodes( root ); - - const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); - float32Array = new Float32Array( buffer ); - uint32Array = new Uint32Array( buffer ); - uint16Array = new Uint16Array( buffer ); - populateBuffer( 0, root ); - rootData.push( buffer ); - - } - - } - + const rootData = bvh._roots; const indexAttribute = geometry.getIndex(); const result = { roots: rootData, @@ -186,9 +98,7 @@ export default class MeshBVH { this._roots = null; if ( ! options[ SKIP_GENERATION ] ) { - // TODO: separate the buffer packing from the serialize function - this._roots = buildTree( geo, options ); - this._roots = MeshBVH.serialize( this, geo, false ).roots; + this._roots = buildPackedTree( geo, options ); } @@ -204,7 +114,7 @@ export default class MeshBVH { function _traverseBuffer( stride4Offset, depth = 0 ) { const stride2Offset = stride4Offset * 2; - const isLeaf = uint16Array[ stride2Offset + 15 ]; + const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf ) { const offset = uint32Array[ stride4Offset + 6 ]; diff --git a/src/buildFunctions.js b/src/buildFunctions.js index a9b1658ed..f882e1492 100644 --- a/src/buildFunctions.js +++ b/src/buildFunctions.js @@ -639,3 +639,90 @@ export function buildTree( geo, options ) { return roots; } + +export const BYTES_PER_NODE = 6 * 4 + 4 + 4; + +export const IS_LEAFNODE_FLAG = 0xFFFF; + +export function buildPackedTree( geo, options ) { + + // boundingData : 6 float32 + // right / offset : 1 uint32 + // splitAxis / isLeaf + count : 1 uint32 / 2 uint16 + const roots = buildTree( geo, options ); + + let float32Array; + let uint32Array; + let uint16Array; + const packedRoots = []; + for ( let i = 0; i < roots.length; i ++ ) { + + const root = roots[ i ]; + let nodeCount = countNodes( root ); + + const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); + float32Array = new Float32Array( buffer ); + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + populateBuffer( 0, root ); + packedRoots.push( buffer ); + + } + + return packedRoots; + + function countNodes( node ) { + + if ( node.count ) { + + return 1; + + } else { + + return 1 + countNodes( node.left ) + countNodes( node.right ); + + } + + } + + function populateBuffer( byteOffset, node ) { + + const stride4Offset = byteOffset / 4; + const stride2Offset = byteOffset / 2; + const isLeaf = ! ! node.count; + const boundingData = node.boundingData; + for ( let i = 0; i < 6; i ++ ) { + + float32Array[ stride4Offset + i ] = boundingData[ i ]; + + } + + if ( isLeaf ) { + + const offset = node.offset; + const count = node.count; + uint32Array[ stride4Offset + 6 ] = offset; + uint16Array[ stride2Offset + 14 ] = count; + uint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG; + return byteOffset + BYTES_PER_NODE; + + } else { + + const left = node.left; + const right = node.right; + const splitAxis = node.splitAxis; + + let nextUnusedPointer; + nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); + + uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; + nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); + + uint32Array[ stride4Offset + 7 ] = splitAxis; + return nextUnusedPointer; + + } + + } + +} From b8992641d4e09b06a71becb3a19fd58282216a05 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 21:59:17 -0800 Subject: [PATCH 030/139] Remove tests reliant on packed data --- test/MeshBVH.test.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/test/MeshBVH.test.js b/test/MeshBVH.test.js index ab03f2263..90828a218 100644 --- a/test/MeshBVH.test.js +++ b/test/MeshBVH.test.js @@ -289,32 +289,6 @@ describe( 'Options', () => { } ); - describe( 'packData', () => { - - it( 'should be constructed to array buffers if packData is true', () => { - - mesh.geometry.computeBoundsTree( { packData: true } ); - - const bvh = mesh.geometry.boundsTree; - expect( bvh._isPacked ).toBeTruthy(); - expect( bvh._roots[ 0 ] instanceof ArrayBuffer ).toBeTruthy(); - expect( getMaxDepth( bvh ) ).toBeGreaterThan( 0 ); - - } ); - - it( 'should be fully constructed as nodes if packData is false.', () => { - - mesh.geometry.computeBoundsTree( { packData: false } ); - - const bvh = mesh.geometry.boundsTree; - expect( bvh._isPacked ).toBeFalsy(); - expect( bvh._roots[ 0 ] instanceof ArrayBuffer ).toBeFalsy(); - expect( getMaxDepth( bvh ) ).toBeGreaterThan( 0 ); - - } ); - - } ); - describe( 'strategy', () => { it.todo( 'should set the split strategy' ); From 050325000f2893808d1b69aafeaad21d80569ef6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 22:00:54 -0800 Subject: [PATCH 031/139] Remove packData references from tests --- test/MeshBVH.test.js | 6 +++--- test/RandomRaycasts.test.js | 21 +++------------------ test/RandomRaycastsRepro.test.js | 6 +++--- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/test/MeshBVH.test.js b/test/MeshBVH.test.js index 90828a218..f2f0b34c9 100644 --- a/test/MeshBVH.test.js +++ b/test/MeshBVH.test.js @@ -183,7 +183,7 @@ describe( 'Serialization', () => { it( 'should serialize then deserialize to the same structure.', () => { const geom = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom, { packData: true } ); + const bvh = new MeshBVH( geom ); const serialized = MeshBVH.serialize( bvh, geom ); const deserializedBVH = MeshBVH.deserialize( serialized, geom ); @@ -194,7 +194,7 @@ describe( 'Serialization', () => { it( 'should copy the index buffer from the target geometry unless copyIndex is set to false', () => { const geom = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom, { packData: true } ); + const bvh = new MeshBVH( geom ); expect( geom.index.array ).not.toBe( MeshBVH.serialize( bvh, geom ).index ); expect( geom.index.array ).toBe( MeshBVH.serialize( bvh, geom, false ).index ); @@ -205,7 +205,7 @@ describe( 'Serialization', () => { const geom1 = new SphereBufferGeometry( 1, 10, 10 ); const geom2 = new SphereBufferGeometry( 1, 10, 10 ); - const bvh = new MeshBVH( geom1, { packData: true } ); + const bvh = new MeshBVH( geom1 ); const serialized = MeshBVH.serialize( bvh, geom1 ); expect( geom2.index.array ).not.toBe( serialized.index ); diff --git a/test/RandomRaycasts.test.js b/test/RandomRaycasts.test.js index 48ff9fadc..6e48e49fb 100644 --- a/test/RandomRaycasts.test.js +++ b/test/RandomRaycasts.test.js @@ -114,23 +114,8 @@ function runRandomTests( options ) { } -describe( 'Random CENTER intersections', () => { +describe( 'Random CENTER intersections', () => runRandomTests( { strategy: CENTER } ) ); - describe( 'split', () => runRandomTests( { strategy: CENTER, packData: false } ) ); - describe( 'Packed split', () => runRandomTests( { strategy: CENTER, packData: true } ) ); +describe( 'Random AVERAGE intersections', () => runRandomTests( { strategy: AVERAGE } ) ); -} ); - -describe( 'Random AVERAGE intersections', () => { - - describe( 'split', () => runRandomTests( { strategy: AVERAGE, packData: false } ) ); - describe( 'Packed split', () => runRandomTests( { strategy: AVERAGE, packData: true } ) ); - -} ); - -describe( 'Random SAH intersections', () => { - - describe( 'split', () => runRandomTests( { strategy: SAH, packData: false } ) ); - describe( 'Packed split', () => runRandomTests( { strategy: SAH, packData: true } ) ); - -} ); +describe( 'Random SAH intersections', () => runRandomTests( { strategy: SAH } ) ); diff --git a/test/RandomRaycastsRepro.test.js b/test/RandomRaycastsRepro.test.js index eb8854772..ff4eae822 100644 --- a/test/RandomRaycastsRepro.test.js +++ b/test/RandomRaycastsRepro.test.js @@ -109,6 +109,6 @@ function runRandomTest( options, transformSeed, raySeed ) { } -runRandomTest( { strategy: AVERAGE, packData: true }, 7830035629, 4697211981 ); -runRandomTest( { strategy: AVERAGE, packData: true }, 8294928772, 1592666709 ); -runRandomTest( { strategy: SAH, packData: true }, 81992501, 8903271423 ); +runRandomTest( { strategy: AVERAGE }, 7830035629, 4697211981 ); +runRandomTest( { strategy: AVERAGE }, 8294928772, 1592666709 ); +runRandomTest( { strategy: SAH }, 81992501, 8903271423 ); From 3cb0689c926ea2db679a351780ad7a56549c2289 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 1 Mar 2021 22:26:22 -0800 Subject: [PATCH 032/139] Clean up cast functions --- src/castFunctionsBuffer.js | 94 +++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/src/castFunctionsBuffer.js b/src/castFunctionsBuffer.js index e50195511..8bdb029a1 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctionsBuffer.js @@ -1,10 +1,3 @@ - -/************************************************************************************************** - * - * This file is generated from castFunctions.js and scripts/generate-cast-function.mjs. Do not edit. - * - *************************************************************************************************/ - import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; @@ -16,27 +9,33 @@ import { CONTAINED } from './Constants.js'; const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; +const IS_LEAFNODE_FLAG = 0xFFFF; export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); + const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf ) { - intersectTris( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ], intersects ); + const offset = uint32Array[ stride4Offset + 6 ]; + const count = uint16Array[ stride2Offset + 14 ]; + + intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); } else { - if ( intersectRayBuffer( /* node left */ stride4Offset + 8, float32Array, ray, boxIntersection ) ) { + const leftIndex = stride4Offset + 8; + if ( intersectRayBuffer( leftIndex, float32Array, ray, boxIntersection ) ) { - raycastBuffer( /* node left */ stride4Offset + 8, mesh, raycaster, ray, intersects ); + raycastBuffer( leftIndex, mesh, raycaster, ray, intersects ); } - if ( intersectRayBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], float32Array, ray, boxIntersection ) ) { + const rightIndex = uint32Array[ stride4Offset + 6 ]; + if ( intersectRayBuffer( rightIndex, float32Array, ray, boxIntersection ) ) { - raycastBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], mesh, raycaster, ray, intersects ); + raycastBuffer( rightIndex, mesh, raycaster, ray, intersects ); } @@ -48,16 +47,18 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); + const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf ) { - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ] ); + const offset = uint32Array[ stride4Offset + 6 ]; + const count = uint16Array[ stride2Offset + 14 ]; + return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); } else { // consider the position of the split plane with respect to the oncoming ray; whichever direction // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = /* node splitAxis */ uint32Array[ stride4Offset + 7 ]; + const splitAxis = uint32Array[ stride4Offset + 7 ]; const xyzAxis = xyzFields[ splitAxis ]; const rayDir = ray.direction[ xyzAxis ]; const leftToRight = rayDir >= 0; @@ -66,13 +67,13 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let c1, c2; if ( leftToRight ) { - c1 = /* node left */ stride4Offset + 8; - c2 = /* node right */ uint32Array[ stride4Offset + 6 ]; + c1 = stride4Offset + 8; // left index + c2 = uint32Array[ stride4Offset + 6 ]; // right index } else { - c1 = /* node right */ uint32Array[ stride4Offset + 6 ]; - c2 = /* node left */ stride4Offset + 8; + c1 = uint32Array[ stride4Offset + 6 ]; // left index + c2 = stride4Offset + 8; // right index } @@ -86,8 +87,8 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { // check if the point is within the second bounds const point = c1Result.point[ xyzAxis ]; const isOutside = leftToRight ? - point <= /* c2 boundingData */ float32Array[ c2 + splitAxis ] : - point >= /* c2 boundingData */ float32Array[ c2 + splitAxis + 3 ]; + point <= float32Array[ c2 + splitAxis ] : // min bounding data + point >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data if ( isOutside ) { @@ -166,46 +167,54 @@ export const shapecastBuffer = ( function () { // when converting to the buffer equivalents function getLeftOffsetBuffer( stride4Offset ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { + // traverse until we find a leaf + while ( uint16Array[ stride2Offset + 15 ] !== IS_LEAFNODE_FLAG ) { - /* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2; + // adjust offset to point to the left node + stride4Offset = stride4Offset + 8; + stride2Offset = stride4Offset * 2; } - return /* node offset */ uint32Array[ stride4Offset + 6 ]; + return uint32Array[ stride4Offset + 6 ]; // triangle offset } function getRightEndOffsetBuffer( stride4Offset ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { + // traverse until we find a leaf + while ( uint16Array[ stride2Offset + 15 ] !== IS_LEAFNODE_FLAG ) { - /* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2; + // adjust offset to point to the right node + stride4Offset = uint32Array[ stride4Offset + 6 ]; + stride2Offset = stride4Offset * 2; } - return /* node offset */ uint32Array[ stride4Offset + 6 ] + /* node count */ uint16Array[ stride2Offset + 14 ]; + // offset + count + // return the end offset of the triangle range + return uint32Array[ stride4Offset + 6 ] + uint16Array[ stride2Offset + 14 ]; } let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); + const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf && intersectsTriangleFunc ) { const geometry = mesh.geometry; - const offset = /* node offset */ uint32Array[ stride4Offset + 6 ]; - const count = /* node count */ uint16Array[ stride2Offset + 14 ]; + const offset = uint32Array[ stride4Offset + 6 ]; + const count = uint16Array[ stride2Offset + 14 ]; return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); } else { - const left = /* node left */ stride4Offset + 8; - const right = /* node right */ uint32Array[ stride4Offset + 6 ]; + const left = stride4Offset + 8; + const right = uint32Array[ stride4Offset + 6 ]; let c1 = left; let c2 = right; @@ -216,6 +225,7 @@ export const shapecastBuffer = ( function () { box1 = cachedBox1; box2 = cachedBox2; + // bounding data is not offset arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); @@ -246,7 +256,7 @@ export const shapecastBuffer = ( function () { } - const isC1Leaf = ! /* c1 count */ ( uint16Array[ c1 + 15 ] !== 0xffff ); + const isC1Leaf = uint16Array[ c1 + 15 ] === IS_LEAFNODE_FLAG; const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); let c1StopTraversal; @@ -284,7 +294,7 @@ export const shapecastBuffer = ( function () { box2 = cachedBox2; arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); - const isC2Leaf = ! /* c2 count */ ( uint16Array[ c2 + 15 ] !== 0xffff ); + const isC2Leaf = uint16Array[ c2 + 15 ] == IS_LEAFNODE_FLAG; const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); let c2StopTraversal; @@ -353,7 +363,7 @@ export const intersectsGeometryBuffer = ( function () { } - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); + const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf ) { const thisGeometry = mesh.geometry; @@ -363,8 +373,8 @@ export const intersectsGeometryBuffer = ( function () { const index = geometry.index; const pos = geometry.attributes.position; - const offset = /* node offset */ uint32Array[ stride4Offset + 6 ]; - const count = /* node count */ uint16Array[ stride2Offset + 14 ]; + const offset = uint32Array[ stride4Offset + 6 ]; + const count = uint16Array[ stride2Offset + 14 ]; // get the inverse of the geometry matrix so we can transform our triangles into the // geometry space we're trying to test. We assume there are fewer triangles being checked @@ -435,8 +445,8 @@ export const intersectsGeometryBuffer = ( function () { } else { - const left = /* node left */ stride4Offset + 8; - const right = /* node right */ uint32Array[ stride4Offset + 6 ]; + const left = stride4Offset + 8; + const right = uint32Array[ stride4Offset + 6 ]; arrayToBoxBuffer( /* left boundingData */ left, float32Array, boundingBox ); const leftIntersection = From a138d6af3e37e3eaae26ad5ff77b9c0e20a4d510 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 3 Mar 2021 23:34:20 -0800 Subject: [PATCH 033/139] Add cast function generation --- package.json | 7 +- scripts/generate-cast-functions.js | 29 + src/MeshBVH.js | 2 +- ...astFunctionsBuffer.js => castFunctions.js} | 46 +- src/castFunctions.template.js | 525 ++++++++++++++++++ 5 files changed, 582 insertions(+), 27 deletions(-) create mode 100644 scripts/generate-cast-functions.js rename src/{castFunctionsBuffer.js => castFunctions.js} (89%) create mode 100644 src/castFunctions.template.js diff --git a/package.json b/package.json index 841a2f369..df601042a 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "main": "src/index.js", "type": "module", "scripts": { - "start": "concurrently \"parcel watch ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache\" \"rollup -w -c\" \"static-server\"", - "build": "rollup -c & parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", - "test": "jest", + "generate-cast-functions": "node scripts/generate-cast-functions.js", + "start": "npm run generate-cast-functions & concurrently \"parcel watch ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache\" \"rollup -w -c\" \"static-server\"", + "build": "npm run generate-cast-functions & rollup -c & parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", + "test": "npm run generate-cast-functions & jest", "lint": "eslint \"./src/*.js\" \"./test/*.js\" \"./example/*.js\"", "benchmark": "node benchmark/run-benchmark.js" }, diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js new file mode 100644 index 000000000..b001bf916 --- /dev/null +++ b/scripts/generate-cast-functions.js @@ -0,0 +1,29 @@ +import path from 'path'; +import fs from 'fs'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); +const inputPath = path.resolve( __dirname, '../src/castFunctions.template.js' ); +const outputPath = path.resolve( __dirname, '../src/castFunctions.js' ); +let contents = fs.readFileSync( inputPath, { encoding: 'utf8' } ); + +contents = replaceFunctionMacro( contents, 'IS_LEAF', 'uint16Array[ $1 + 15 ] === 0xFFFF' ); +contents = replaceFunctionMacro( contents, 'OFFSET', 'uint32Array[ $1 + 6 ]' ); +contents = replaceFunctionMacro( contents, 'COUNT', 'uint16Array[ $1 + 14 ]' ); +contents = replaceFunctionMacro( contents, 'LEFT_NODE', '$1 + 8' ); +contents = replaceFunctionMacro( contents, 'RIGHT_NODE', 'uint32Array[ $1 + 6 ]' ); +contents = replaceFunctionMacro( contents, 'SPLIT_AXIS', 'uint32Array[ $1 + 7 ]' ); +contents = replaceFunctionMacro( contents, 'BOUNDING_DATA_INDEX', '$1' ); + +fs.writeFileSync( outputPath, contents ); + +function replaceFunctionMacro( contents, name, body ) { + + const regexp = new RegExp( `${ name }\\((.*?)\\)`, 'g' ); + return contents.replace( regexp, ( match, arg ) => { + + return body.replace( /\$1/g, arg.trim() ); + + } ); + +} diff --git a/src/MeshBVH.js b/src/MeshBVH.js index d3831a003..46020f5e7 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -11,7 +11,7 @@ import { intersectsGeometryBuffer, setBuffer, clearBuffer, -} from './castFunctionsBuffer.js'; +} from './castFunctions.js'; const SKIP_GENERATION = Symbol( 'skip tree generation' ); diff --git a/src/castFunctionsBuffer.js b/src/castFunctions.js similarity index 89% rename from src/castFunctionsBuffer.js rename to src/castFunctions.js index 8bdb029a1..c8f2cccba 100644 --- a/src/castFunctionsBuffer.js +++ b/src/castFunctions.js @@ -1,3 +1,6 @@ +/* global + IS_LEAF, OFFSET, COUNT, RIGHT_NODE, LEFT_NODE, BOUNDING_DATA_INDEX, +*/ import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; @@ -9,13 +12,12 @@ import { CONTAINED } from './Constants.js'; const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -const IS_LEAFNODE_FLAG = 0xFFFF; export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; + const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; if ( isLeaf ) { const offset = uint32Array[ stride4Offset + 6 ]; @@ -47,7 +49,7 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; + const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; if ( isLeaf ) { const offset = uint32Array[ stride4Offset + 6 ]; @@ -67,13 +69,13 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let c1, c2; if ( leftToRight ) { - c1 = stride4Offset + 8; // left index - c2 = uint32Array[ stride4Offset + 6 ]; // right index + c1 = stride4Offset + 8; + c2 = uint32Array[ stride4Offset + 6 ]; } else { - c1 = uint32Array[ stride4Offset + 6 ]; // left index - c2 = stride4Offset + 8; // right index + c1 = uint32Array[ stride4Offset + 6 ]; + c2 = stride4Offset + 8; } @@ -170,15 +172,14 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( uint16Array[ stride2Offset + 15 ] !== IS_LEAFNODE_FLAG ) { + while ( ! uint16Array[ stride2Offset + 15 ] === 0xFFFF ) { - // adjust offset to point to the left node stride4Offset = stride4Offset + 8; stride2Offset = stride4Offset * 2; } - return uint32Array[ stride4Offset + 6 ]; // triangle offset + return uint32Array[ stride4Offset + 6 ]; } @@ -187,7 +188,7 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( uint16Array[ stride2Offset + 15 ] !== IS_LEAFNODE_FLAG ) { + while ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ) { // adjust offset to point to the right node stride4Offset = uint32Array[ stride4Offset + 6 ]; @@ -195,7 +196,6 @@ export const shapecastBuffer = ( function () { } - // offset + count // return the end offset of the triangle range return uint32Array[ stride4Offset + 6 ] + uint16Array[ stride2Offset + 14 ]; @@ -203,7 +203,7 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; + const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; if ( isLeaf && intersectsTriangleFunc ) { const geometry = mesh.geometry; @@ -226,8 +226,8 @@ export const shapecastBuffer = ( function () { box2 = cachedBox2; // bounding data is not offset - arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); - arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); + arrayToBoxBuffer( c1, float32Array, box1 ); + arrayToBoxBuffer( c2, float32Array, box2 ); score1 = nodeScoreFunc( box1 ); score2 = nodeScoreFunc( box2 ); @@ -252,11 +252,11 @@ export const shapecastBuffer = ( function () { if ( ! box1 ) { box1 = cachedBox1; - arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); + arrayToBoxBuffer( c1, float32Array, box1 ); } - const isC1Leaf = uint16Array[ c1 + 15 ] === IS_LEAFNODE_FLAG; + const isC1Leaf = uint16Array[ c1 + 15 ] === 0xFFFF; const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); let c1StopTraversal; @@ -292,9 +292,9 @@ export const shapecastBuffer = ( function () { // Check box 2 intersection // cached box2 will have been overwritten by previous traversal box2 = cachedBox2; - arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); + arrayToBoxBuffer( c2, float32Array, box2 ); - const isC2Leaf = uint16Array[ c2 + 15 ] == IS_LEAFNODE_FLAG; + const isC2Leaf = uint16Array[ c2 + 15 ] === 0xFFFF; const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); let c2StopTraversal; @@ -363,7 +363,7 @@ export const intersectsGeometryBuffer = ( function () { } - const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; + const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; if ( isLeaf ) { const thisGeometry = mesh.geometry; @@ -383,7 +383,7 @@ export const intersectsGeometryBuffer = ( function () { if ( geometry.boundsTree ) { - arrayToBoxBuffer( /* node boundingData */ stride4Offset, float32Array, obb2 ); + arrayToBoxBuffer( stride4Offset, float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); @@ -448,14 +448,14 @@ export const intersectsGeometryBuffer = ( function () { const left = stride4Offset + 8; const right = uint32Array[ stride4Offset + 6 ]; - arrayToBoxBuffer( /* left boundingData */ left, float32Array, boundingBox ); + arrayToBoxBuffer( left, float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && intersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; - arrayToBoxBuffer( /* right boundingData */ right, float32Array, boundingBox ); + arrayToBoxBuffer( right, float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && intersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb ); diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js new file mode 100644 index 000000000..3a41fbdb9 --- /dev/null +++ b/src/castFunctions.template.js @@ -0,0 +1,525 @@ +/* global + IS_LEAF, OFFSET, COUNT, RIGHT_NODE, LEFT_NODE, BOUNDING_DATA_INDEX, +*/ +import { Box3, Vector3, Mesh, Matrix4 } from 'three'; +import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; + +import { OrientedBox } from './Utils/OrientedBox.js'; +import { setTriangle } from './Utils/TriangleUtils.js'; +import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; +import { CONTAINED } from './Constants.js'; + +const boundingBox = new Box3(); +const boxIntersection = new Vector3(); +const xyzFields = [ 'x', 'y', 'z' ]; + +export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { + + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = IS_LEAF( stride2Offset ); + if ( isLeaf ) { + + const offset = OFFSET( stride4Offset ); + const count = COUNT( stride2Offset ); + + intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); + + } else { + + const leftIndex = LEFT_NODE( stride4Offset ); + if ( intersectRayBuffer( leftIndex, float32Array, ray, boxIntersection ) ) { + + raycastBuffer( leftIndex, mesh, raycaster, ray, intersects ); + + } + + const rightIndex = RIGHT_NODE( stride4Offset ); + if ( intersectRayBuffer( rightIndex, float32Array, ray, boxIntersection ) ) { + + raycastBuffer( rightIndex, mesh, raycaster, ray, intersects ); + + } + + } + +} + +export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { + + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = IS_LEAF( stride2Offset ); + if ( isLeaf ) { + + const offset = OFFSET( stride4Offset ); + const count = COUNT( stride2Offset ); + return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); + + } else { + + // consider the position of the split plane with respect to the oncoming ray; whichever direction + // the ray is coming from, look for an intersection among that side of the tree first + const splitAxis = SPLIT_AXIS( stride4Offset ); + const xyzAxis = xyzFields[ splitAxis ]; + const rayDir = ray.direction[ xyzAxis ]; + const leftToRight = rayDir >= 0; + + // c1 is the child to check first + let c1, c2; + if ( leftToRight ) { + + c1 = LEFT_NODE( stride4Offset ); + c2 = RIGHT_NODE( stride4Offset ); + + } else { + + c1 = RIGHT_NODE( stride4Offset ); + c2 = LEFT_NODE( stride4Offset ); + + } + + const c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection ); + const c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null; + + // if we got an intersection in the first node and it's closer than the second node's bounding + // box, we don't need to consider the second node because it couldn't possibly be a better result + if ( c1Result ) { + + // check if the point is within the second bounds + const point = c1Result.point[ xyzAxis ]; + const isOutside = leftToRight ? + point <= float32Array[ c2 + splitAxis ] : // min bounding data + point >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data + + if ( isOutside ) { + + return c1Result; + + } + + } + + // either there was no intersection in the first node, or there could still be a closer + // intersection in the second, so check the second node and then take the better of the two + const c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection ); + const c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null; + + if ( c1Result && c2Result ) { + + return c1Result.distance <= c2Result.distance ? c1Result : c2Result; + + } else { + + return c1Result || c2Result || null; + + } + + } + +} + +export const shapecastBuffer = ( function () { + + const _triangle = new SeparatingAxisTriangle(); + const _cachedBox1 = new Box3(); + const _cachedBox2 = new Box3(); + + function iterateOverTriangles( + offset, + count, + geometry, + intersectsTriangleFunc, + contained, + depth, + triangle + ) { + + const index = geometry.index; + const pos = geometry.attributes.position; + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + setTriangle( triangle, i, index, pos ); + triangle.needsUpdate = true; + + if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { + + return true; + + } + + } + + return false; + + } + + return function shapecastBuffer( stride4Offset, + mesh, + intersectsBoundsFunc, + intersectsTriangleFunc = null, + nodeScoreFunc = null, + depth = 0, + triangle = _triangle, + cachedBox1 = _cachedBox1, + cachedBox2 = _cachedBox2 + ) { + + // Define these inside the function so it has access to the local variables needed + // when converting to the buffer equivalents + function getLeftOffsetBuffer( stride4Offset ) { + + let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + + // traverse until we find a leaf + while ( ! IS_LEAF( stride2Offset ) ) { + + stride4Offset = LEFT_NODE( stride4Offset ); + stride2Offset = stride4Offset * 2; + + } + + return OFFSET( stride4Offset ); + + } + + function getRightEndOffsetBuffer( stride4Offset ) { + + let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + + // traverse until we find a leaf + while ( IS_LEAF( stride2Offset ) ) { + + // adjust offset to point to the right node + stride4Offset = RIGHT_NODE( stride4Offset ); + stride2Offset = stride4Offset * 2; + + } + + // return the end offset of the triangle range + return OFFSET( stride4Offset ) + COUNT( stride2Offset ); + + } + + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = IS_LEAF( stride2Offset ); + if ( isLeaf && intersectsTriangleFunc ) { + + const geometry = mesh.geometry; + const offset = OFFSET( stride4Offset ); + const count = COUNT( stride2Offset ); + return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); + + } else { + + const left = LEFT_NODE( stride4Offset ); + const right = RIGHT_NODE( stride4Offset ); + let c1 = left; + let c2 = right; + + let score1, score2; + let box1, box2; + if ( nodeScoreFunc ) { + + box1 = cachedBox1; + box2 = cachedBox2; + + // bounding data is not offset + arrayToBoxBuffer( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 ); + arrayToBoxBuffer( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); + + score1 = nodeScoreFunc( box1 ); + score2 = nodeScoreFunc( box2 ); + + if ( score2 < score1 ) { + + c1 = right; + c2 = left; + + const temp = score1; + score1 = score2; + score2 = temp; + + box1 = box2; + // box2 is always set before use below + + } + + } + + // Check box 1 intersection + if ( ! box1 ) { + + box1 = cachedBox1; + arrayToBoxBuffer( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 ); + + } + + const isC1Leaf = IS_LEAF( c1 ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); + + let c1StopTraversal; + if ( c1Intersection === CONTAINED ) { + + const geometry = mesh.geometry; + const offset = getLeftOffsetBuffer( c1 ); + const end = getRightEndOffsetBuffer( c1 ); + const count = end - offset; + + c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + + } else { + + c1StopTraversal = + c1Intersection && + shapecastBuffer( + c1, + mesh, + intersectsBoundsFunc, + intersectsTriangleFunc, + nodeScoreFunc, + depth + 1, + triangle, + cachedBox1, + cachedBox2 + ); + + } + + if ( c1StopTraversal ) return true; + + // Check box 2 intersection + // cached box2 will have been overwritten by previous traversal + box2 = cachedBox2; + arrayToBoxBuffer( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); + + const isC2Leaf = IS_LEAF( c2 ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); + + let c2StopTraversal; + if ( c2Intersection === CONTAINED ) { + + const geometry = mesh.geometry; + const offset = getLeftOffsetBuffer( c2 ); + const end = getRightEndOffsetBuffer( c2 ); + const count = end - offset; + + c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + + } else { + + c2StopTraversal = + c2Intersection && + shapecastBuffer( + c2, + mesh, + intersectsBoundsFunc, + intersectsTriangleFunc, + nodeScoreFunc, + depth + 1, + triangle, + cachedBox1, + cachedBox2 + ); + + } + + if ( c2StopTraversal ) return true; + + return false; + + } + + }; + +} )(); + +export const intersectsGeometryBuffer = ( function () { + + const triangle = new SeparatingAxisTriangle(); + const triangle2 = new SeparatingAxisTriangle(); + const cachedMesh = new Mesh(); + const invertedMat = new Matrix4(); + + const obb = new OrientedBox(); + const obb2 = new OrientedBox(); + + return function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) { + + let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + if ( cachedObb === null ) { + + if ( ! geometry.boundingBox ) { + + geometry.computeBoundingBox(); + + } + + obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); + obb.update(); + cachedObb = obb; + + } + + const isLeaf = IS_LEAF( stride2Offset ); + if ( isLeaf ) { + + const thisGeometry = mesh.geometry; + const thisIndex = thisGeometry.index; + const thisPos = thisGeometry.attributes.position; + + const index = geometry.index; + const pos = geometry.attributes.position; + + const offset = OFFSET( stride4Offset ); + const count = COUNT( stride2Offset ); + + // get the inverse of the geometry matrix so we can transform our triangles into the + // geometry space we're trying to test. We assume there are fewer triangles being checked + // here. + invertedMat.copy( geometryToBvh ).invert(); + + if ( geometry.boundsTree ) { + + arrayToBoxBuffer( BOUNDING_DATA_INDEX( stride4Offset ), float32Array, obb2 ); + obb2.matrix.copy( invertedMat ); + obb2.update(); + + cachedMesh.geometry = geometry; + const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + + tri.a.applyMatrix4( geometryToBvh ); + tri.b.applyMatrix4( geometryToBvh ); + tri.c.applyMatrix4( geometryToBvh ); + tri.update(); + + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle2, i, thisIndex, thisPos ); + triangle2.update(); + if ( tri.intersectsTriangle( triangle2 ) ) { + + return true; + + } + + } + + return false; + + } ); + cachedMesh.geometry = null; + + return res; + + } else { + + for ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle, i, thisIndex, thisPos ); + triangle.a.applyMatrix4( invertedMat ); + triangle.b.applyMatrix4( invertedMat ); + triangle.c.applyMatrix4( invertedMat ); + triangle.update(); + + for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + + setTriangle( triangle2, i2, index, pos ); + triangle2.update(); + + if ( triangle.intersectsTriangle( triangle2 ) ) { + + return true; + + } + + } + + } + + } + + } else { + + const left = stride4Offset + 8; + const right = uint32Array[ stride4Offset + 6 ]; + + arrayToBoxBuffer( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox ); + const leftIntersection = + cachedObb.intersectsBox( boundingBox ) && + intersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb ); + + if ( leftIntersection ) return true; + + arrayToBoxBuffer( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox ); + const rightIntersection = + cachedObb.intersectsBox( boundingBox ) && + intersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb ); + + if ( rightIntersection ) return true; + + return false; + + } + + }; + +} )(); + +function intersectRayBuffer( stride4Offset, array, ray, target ) { + + arrayToBoxBuffer( stride4Offset, array, boundingBox ); + return ray.intersectBox( boundingBox, target ); + +} + +const bufferStack = []; +let _prevBuffer; +let _float32Array; +let _uint16Array; +let _uint32Array; +export function setBuffer( buffer ) { + + if ( _prevBuffer ) { + + bufferStack.push( _prevBuffer ); + + } + + _prevBuffer = buffer; + _float32Array = new Float32Array( buffer ); + _uint16Array = new Uint16Array( buffer ); + _uint32Array = new Uint32Array( buffer ); + +} + +export function clearBuffer() { + + _prevBuffer = null; + _float32Array = null; + _uint16Array = null; + _uint32Array = null; + + if ( bufferStack.length ) { + + setBuffer( bufferStack.pop() ); + + } + +} + +function arrayToBoxBuffer( stride4Offset, array, target ) { + + target.min.x = array[ stride4Offset ]; + target.min.y = array[ stride4Offset + 1 ]; + target.min.z = array[ stride4Offset + 2 ]; + + target.max.x = array[ stride4Offset + 3 ]; + target.max.y = array[ stride4Offset + 4 ]; + target.max.z = array[ stride4Offset + 5 ]; + +} From 9bd40feccdc37db1cb7364a8be8ebc7d8c30b961 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 3 Mar 2021 23:35:14 -0800 Subject: [PATCH 034/139] lint fix --- scripts/generate-cast-functions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index b001bf916..0e59b35ff 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -1,3 +1,4 @@ +/* eslint-disable */ import path from 'path'; import fs from 'fs'; import { fileURLToPath } from 'url'; From d6267cdf8ce7668070053d33cc120430a35e0d79 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 3 Mar 2021 23:46:57 -0800 Subject: [PATCH 035/139] Fix tests --- scripts/generate-cast-functions.js | 2 +- src/castFunctions.js | 16 ++++++++-------- src/castFunctions.template.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index 0e59b35ff..5b94af12f 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -8,7 +8,7 @@ const inputPath = path.resolve( __dirname, '../src/castFunctions.template.js' ); const outputPath = path.resolve( __dirname, '../src/castFunctions.js' ); let contents = fs.readFileSync( inputPath, { encoding: 'utf8' } ); -contents = replaceFunctionMacro( contents, 'IS_LEAF', 'uint16Array[ $1 + 15 ] === 0xFFFF' ); +contents = replaceFunctionMacro( contents, 'IS_LEAF', '( uint16Array[ $1 + 15 ] === 0xFFFF )' ); contents = replaceFunctionMacro( contents, 'OFFSET', 'uint32Array[ $1 + 6 ]' ); contents = replaceFunctionMacro( contents, 'COUNT', 'uint16Array[ $1 + 14 ]' ); contents = replaceFunctionMacro( contents, 'LEFT_NODE', '$1 + 8' ); diff --git a/src/castFunctions.js b/src/castFunctions.js index c8f2cccba..cdddd9523 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -17,7 +17,7 @@ export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; + const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); if ( isLeaf ) { const offset = uint32Array[ stride4Offset + 6 ]; @@ -49,7 +49,7 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; + const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); if ( isLeaf ) { const offset = uint32Array[ stride4Offset + 6 ]; @@ -172,7 +172,7 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( ! uint16Array[ stride2Offset + 15 ] === 0xFFFF ) { + while ( ! ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ) ) { stride4Offset = stride4Offset + 8; stride2Offset = stride4Offset * 2; @@ -188,7 +188,7 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ) { + while ( ! ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ) ) { // adjust offset to point to the right node stride4Offset = uint32Array[ stride4Offset + 6 ]; @@ -203,7 +203,7 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; + const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); if ( isLeaf && intersectsTriangleFunc ) { const geometry = mesh.geometry; @@ -256,7 +256,7 @@ export const shapecastBuffer = ( function () { } - const isC1Leaf = uint16Array[ c1 + 15 ] === 0xFFFF; + const isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF ); const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); let c1StopTraversal; @@ -294,7 +294,7 @@ export const shapecastBuffer = ( function () { box2 = cachedBox2; arrayToBoxBuffer( c2, float32Array, box2 ); - const isC2Leaf = uint16Array[ c2 + 15 ] === 0xFFFF; + const isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF ); const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); let c2StopTraversal; @@ -363,7 +363,7 @@ export const intersectsGeometryBuffer = ( function () { } - const isLeaf = uint16Array[ stride2Offset + 15 ] === 0xFFFF; + const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); if ( isLeaf ) { const thisGeometry = mesh.geometry; diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 3a41fbdb9..1a0efa970 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -188,7 +188,7 @@ export const shapecastBuffer = ( function () { let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( IS_LEAF( stride2Offset ) ) { + while ( ! IS_LEAF( stride2Offset ) ) { // adjust offset to point to the right node stride4Offset = RIGHT_NODE( stride4Offset ); From 016c4f5796029ff9059586f0bf2fb5a06f26c3c3 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 3 Mar 2021 23:53:47 -0800 Subject: [PATCH 036/139] strideOffset -> nodeIndex --- src/castFunctions.template.js | 106 +++++++++++++++++----------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 1a0efa970..b1b5bbe16 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -13,28 +13,28 @@ const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { +export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = IS_LEAF( stride2Offset ); + const isLeaf = IS_LEAF( nodeIndex16 ); if ( isLeaf ) { - const offset = OFFSET( stride4Offset ); - const count = COUNT( stride2Offset ); + const offset = OFFSET( nodeIndex32 ); + const count = COUNT( nodeIndex16 ); intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); } else { - const leftIndex = LEFT_NODE( stride4Offset ); + const leftIndex = LEFT_NODE( nodeIndex32 ); if ( intersectRayBuffer( leftIndex, float32Array, ray, boxIntersection ) ) { raycastBuffer( leftIndex, mesh, raycaster, ray, intersects ); } - const rightIndex = RIGHT_NODE( stride4Offset ); + const rightIndex = RIGHT_NODE( nodeIndex32 ); if ( intersectRayBuffer( rightIndex, float32Array, ray, boxIntersection ) ) { raycastBuffer( rightIndex, mesh, raycaster, ray, intersects ); @@ -45,22 +45,22 @@ export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) } -export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { +export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = IS_LEAF( stride2Offset ); + const isLeaf = IS_LEAF( nodeIndex16 ); if ( isLeaf ) { - const offset = OFFSET( stride4Offset ); - const count = COUNT( stride2Offset ); + const offset = OFFSET( nodeIndex32 ); + const count = COUNT( nodeIndex16 ); return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); } else { // consider the position of the split plane with respect to the oncoming ray; whichever direction // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = SPLIT_AXIS( stride4Offset ); + const splitAxis = SPLIT_AXIS( nodeIndex32 ); const xyzAxis = xyzFields[ splitAxis ]; const rayDir = ray.direction[ xyzAxis ]; const leftToRight = rayDir >= 0; @@ -69,13 +69,13 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let c1, c2; if ( leftToRight ) { - c1 = LEFT_NODE( stride4Offset ); - c2 = RIGHT_NODE( stride4Offset ); + c1 = LEFT_NODE( nodeIndex32 ); + c2 = RIGHT_NODE( nodeIndex32 ); } else { - c1 = RIGHT_NODE( stride4Offset ); - c2 = LEFT_NODE( stride4Offset ); + c1 = RIGHT_NODE( nodeIndex32 ); + c2 = LEFT_NODE( nodeIndex32 ); } @@ -154,7 +154,7 @@ export const shapecastBuffer = ( function () { } - return function shapecastBuffer( stride4Offset, + return function shapecastBuffer( nodeIndex32, mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, @@ -167,54 +167,54 @@ export const shapecastBuffer = ( function () { // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents - function getLeftOffsetBuffer( stride4Offset ) { + function getLeftOffsetBuffer( nodeIndex32 ) { - let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( ! IS_LEAF( stride2Offset ) ) { + while ( ! IS_LEAF( nodeIndex16 ) ) { - stride4Offset = LEFT_NODE( stride4Offset ); - stride2Offset = stride4Offset * 2; + nodeIndex32 = LEFT_NODE( nodeIndex32 ); + nodeIndex16 = nodeIndex32 * 2; } - return OFFSET( stride4Offset ); + return OFFSET( nodeIndex32 ); } - function getRightEndOffsetBuffer( stride4Offset ) { + function getRightEndOffsetBuffer( nodeIndex32 ) { - let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( ! IS_LEAF( stride2Offset ) ) { + while ( ! IS_LEAF( nodeIndex16 ) ) { // adjust offset to point to the right node - stride4Offset = RIGHT_NODE( stride4Offset ); - stride2Offset = stride4Offset * 2; + nodeIndex32 = RIGHT_NODE( nodeIndex32 ); + nodeIndex16 = nodeIndex32 * 2; } // return the end offset of the triangle range - return OFFSET( stride4Offset ) + COUNT( stride2Offset ); + return OFFSET( nodeIndex32 ) + COUNT( nodeIndex16 ); } - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = IS_LEAF( stride2Offset ); + const isLeaf = IS_LEAF( nodeIndex16 ); if ( isLeaf && intersectsTriangleFunc ) { const geometry = mesh.geometry; - const offset = OFFSET( stride4Offset ); - const count = COUNT( stride2Offset ); + const offset = OFFSET( nodeIndex32 ); + const count = COUNT( nodeIndex16 ); return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); } else { - const left = LEFT_NODE( stride4Offset ); - const right = RIGHT_NODE( stride4Offset ); + const left = LEFT_NODE( nodeIndex32 ); + const right = RIGHT_NODE( nodeIndex32 ); let c1 = left; let c2 = right; @@ -345,9 +345,9 @@ export const intersectsGeometryBuffer = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) { + return function intersectsGeometryBuffer( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; if ( cachedObb === null ) { @@ -363,7 +363,7 @@ export const intersectsGeometryBuffer = ( function () { } - const isLeaf = IS_LEAF( stride2Offset ); + const isLeaf = IS_LEAF( nodeIndex16 ); if ( isLeaf ) { const thisGeometry = mesh.geometry; @@ -373,8 +373,8 @@ export const intersectsGeometryBuffer = ( function () { const index = geometry.index; const pos = geometry.attributes.position; - const offset = OFFSET( stride4Offset ); - const count = COUNT( stride2Offset ); + const offset = OFFSET( nodeIndex32 ); + const count = COUNT( nodeIndex16 ); // get the inverse of the geometry matrix so we can transform our triangles into the // geometry space we're trying to test. We assume there are fewer triangles being checked @@ -383,7 +383,7 @@ export const intersectsGeometryBuffer = ( function () { if ( geometry.boundsTree ) { - arrayToBoxBuffer( BOUNDING_DATA_INDEX( stride4Offset ), float32Array, obb2 ); + arrayToBoxBuffer( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); @@ -445,8 +445,8 @@ export const intersectsGeometryBuffer = ( function () { } else { - const left = stride4Offset + 8; - const right = uint32Array[ stride4Offset + 6 ]; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; arrayToBoxBuffer( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox ); const leftIntersection = @@ -470,9 +470,9 @@ export const intersectsGeometryBuffer = ( function () { } )(); -function intersectRayBuffer( stride4Offset, array, ray, target ) { +function intersectRayBuffer( nodeIndex32, array, ray, target ) { - arrayToBoxBuffer( stride4Offset, array, boundingBox ); + arrayToBoxBuffer( nodeIndex32, array, boundingBox ); return ray.intersectBox( boundingBox, target ); } @@ -512,14 +512,14 @@ export function clearBuffer() { } -function arrayToBoxBuffer( stride4Offset, array, target ) { +function arrayToBoxBuffer( nodeIndex32, array, target ) { - target.min.x = array[ stride4Offset ]; - target.min.y = array[ stride4Offset + 1 ]; - target.min.z = array[ stride4Offset + 2 ]; + target.min.x = array[ nodeIndex32 ]; + target.min.y = array[ nodeIndex32 + 1 ]; + target.min.z = array[ nodeIndex32 + 2 ]; - target.max.x = array[ stride4Offset + 3 ]; - target.max.y = array[ stride4Offset + 4 ]; - target.max.z = array[ stride4Offset + 5 ]; + target.max.x = array[ nodeIndex32 + 3 ]; + target.max.y = array[ nodeIndex32 + 4 ]; + target.max.z = array[ nodeIndex32 + 5 ]; } From 773b8ed2e7aa52c4a74f3f0a1a7da922130105ca Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 3 Mar 2021 23:58:38 -0800 Subject: [PATCH 037/139] regenerate cast functions --- package.json | 2 +- src/castFunctions.js | 106 +++++++++++++++++++++---------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index e0555323c..0977a0732 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build": "npm run generate-cast-functions & rollup -c & parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", "test": "npm run generate-cast-functions & jest", "lint": "eslint \"./src/*.js\" \"./test/*.js\" \"./example/*.js\"", - "benchmark": "node benchmark/run-benchmark.js" + "benchmark": "npm run generate-cast-functions & node benchmark/run-benchmark.js" }, "files": [ "src/*", diff --git a/src/castFunctions.js b/src/castFunctions.js index cdddd9523..355c86010 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -13,28 +13,28 @@ const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { +export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); } else { - const leftIndex = stride4Offset + 8; + const leftIndex = nodeIndex32 + 8; if ( intersectRayBuffer( leftIndex, float32Array, ray, boxIntersection ) ) { raycastBuffer( leftIndex, mesh, raycaster, ray, intersects ); } - const rightIndex = uint32Array[ stride4Offset + 6 ]; + const rightIndex = uint32Array[ nodeIndex32 + 6 ]; if ( intersectRayBuffer( rightIndex, float32Array, ray, boxIntersection ) ) { raycastBuffer( rightIndex, mesh, raycaster, ray, intersects ); @@ -45,22 +45,22 @@ export function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) } -export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { +export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); } else { // consider the position of the split plane with respect to the oncoming ray; whichever direction // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = uint32Array[ stride4Offset + 7 ]; + const splitAxis = uint32Array[ nodeIndex32 + 7 ]; const xyzAxis = xyzFields[ splitAxis ]; const rayDir = ray.direction[ xyzAxis ]; const leftToRight = rayDir >= 0; @@ -69,13 +69,13 @@ export function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { let c1, c2; if ( leftToRight ) { - c1 = stride4Offset + 8; - c2 = uint32Array[ stride4Offset + 6 ]; + c1 = nodeIndex32 + 8; + c2 = uint32Array[ nodeIndex32 + 6 ]; } else { - c1 = uint32Array[ stride4Offset + 6 ]; - c2 = stride4Offset + 8; + c1 = uint32Array[ nodeIndex32 + 6 ]; + c2 = nodeIndex32 + 8; } @@ -154,7 +154,7 @@ export const shapecastBuffer = ( function () { } - return function shapecastBuffer( stride4Offset, + return function shapecastBuffer( nodeIndex32, mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, @@ -167,54 +167,54 @@ export const shapecastBuffer = ( function () { // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents - function getLeftOffsetBuffer( stride4Offset ) { + function getLeftOffsetBuffer( nodeIndex32 ) { - let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( ! ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ) ) { + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { - stride4Offset = stride4Offset + 8; - stride2Offset = stride4Offset * 2; + nodeIndex32 = nodeIndex32 + 8; + nodeIndex16 = nodeIndex32 * 2; } - return uint32Array[ stride4Offset + 6 ]; + return uint32Array[ nodeIndex32 + 6 ]; } - function getRightEndOffsetBuffer( stride4Offset ) { + function getRightEndOffsetBuffer( nodeIndex32 ) { - let stride2Offset = stride4Offset * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; // traverse until we find a leaf - while ( ! ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ) ) { + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { // adjust offset to point to the right node - stride4Offset = uint32Array[ stride4Offset + 6 ]; - stride2Offset = stride4Offset * 2; + nodeIndex32 = uint32Array[ nodeIndex32 + 6 ]; + nodeIndex16 = nodeIndex32 * 2; } // return the end offset of the triangle range - return uint32Array[ stride4Offset + 6 ] + uint16Array[ stride2Offset + 14 ]; + return uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ]; } - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf && intersectsTriangleFunc ) { const geometry = mesh.geometry; - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); } else { - const left = stride4Offset + 8; - const right = uint32Array[ stride4Offset + 6 ]; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; let c1 = left; let c2 = right; @@ -345,9 +345,9 @@ export const intersectsGeometryBuffer = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) { + return function intersectsGeometryBuffer( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; if ( cachedObb === null ) { @@ -363,7 +363,7 @@ export const intersectsGeometryBuffer = ( function () { } - const isLeaf = ( uint16Array[ stride2Offset + 15 ] === 0xFFFF ); + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { const thisGeometry = mesh.geometry; @@ -373,8 +373,8 @@ export const intersectsGeometryBuffer = ( function () { const index = geometry.index; const pos = geometry.attributes.position; - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; // get the inverse of the geometry matrix so we can transform our triangles into the // geometry space we're trying to test. We assume there are fewer triangles being checked @@ -383,7 +383,7 @@ export const intersectsGeometryBuffer = ( function () { if ( geometry.boundsTree ) { - arrayToBoxBuffer( stride4Offset, float32Array, obb2 ); + arrayToBoxBuffer( nodeIndex32, float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); @@ -445,8 +445,8 @@ export const intersectsGeometryBuffer = ( function () { } else { - const left = stride4Offset + 8; - const right = uint32Array[ stride4Offset + 6 ]; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; arrayToBoxBuffer( left, float32Array, boundingBox ); const leftIntersection = @@ -470,9 +470,9 @@ export const intersectsGeometryBuffer = ( function () { } )(); -function intersectRayBuffer( stride4Offset, array, ray, target ) { +function intersectRayBuffer( nodeIndex32, array, ray, target ) { - arrayToBoxBuffer( stride4Offset, array, boundingBox ); + arrayToBoxBuffer( nodeIndex32, array, boundingBox ); return ray.intersectBox( boundingBox, target ); } @@ -512,14 +512,14 @@ export function clearBuffer() { } -function arrayToBoxBuffer( stride4Offset, array, target ) { +function arrayToBoxBuffer( nodeIndex32, array, target ) { - target.min.x = array[ stride4Offset ]; - target.min.y = array[ stride4Offset + 1 ]; - target.min.z = array[ stride4Offset + 2 ]; + target.min.x = array[ nodeIndex32 ]; + target.min.y = array[ nodeIndex32 + 1 ]; + target.min.z = array[ nodeIndex32 + 2 ]; - target.max.x = array[ stride4Offset + 3 ]; - target.max.y = array[ stride4Offset + 4 ]; - target.max.z = array[ stride4Offset + 5 ]; + target.max.x = array[ nodeIndex32 + 3 ]; + target.max.y = array[ nodeIndex32 + 4 ]; + target.max.z = array[ nodeIndex32 + 5 ]; } From ab320077c0fdea6dd144fc424bbf289e2403e494 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 00:03:39 -0800 Subject: [PATCH 038/139] comments --- scripts/generate-cast-functions.js | 1 + src/castFunctions.js | 7 ++++--- src/castFunctions.template.js | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/generate-cast-functions.js b/scripts/generate-cast-functions.js index 5b94af12f..ebba10bfb 100644 --- a/scripts/generate-cast-functions.js +++ b/scripts/generate-cast-functions.js @@ -15,6 +15,7 @@ contents = replaceFunctionMacro( contents, 'LEFT_NODE', '$1 + 8' ); contents = replaceFunctionMacro( contents, 'RIGHT_NODE', 'uint32Array[ $1 + 6 ]' ); contents = replaceFunctionMacro( contents, 'SPLIT_AXIS', 'uint32Array[ $1 + 7 ]' ); contents = replaceFunctionMacro( contents, 'BOUNDING_DATA_INDEX', '$1' ); +contents = contents.replace( /^\/\*[\S\s]*?\*\//g, '/* Generated from "castFunctions.template.js". Do not edit. */' ); fs.writeFileSync( outputPath, contents ); diff --git a/src/castFunctions.js b/src/castFunctions.js index 355c86010..48381515f 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -1,6 +1,7 @@ -/* global - IS_LEAF, OFFSET, COUNT, RIGHT_NODE, LEFT_NODE, BOUNDING_DATA_INDEX, -*/ +/* Generated from "castFunctions.template.js". Do not edit. */ + +// For speed and readability this script is processed to replace the macro-like calls +// with inline buffer reads. See generate-cast-functions.js. import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index b1b5bbe16..41e02e77d 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -1,6 +1,9 @@ /* global - IS_LEAF, OFFSET, COUNT, RIGHT_NODE, LEFT_NODE, BOUNDING_DATA_INDEX, + IS_LEAF, OFFSET, COUNT, RIGHT_NODE, LEFT_NODE, BOUNDING_DATA_INDEX, SPLIT_AXIS */ + +// For speed and readability this script is processed to replace the macro-like calls +// with inline buffer reads. See generate-cast-functions.js. import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; From e8b6aa70c8c7185114286e890beecfd29f020fb6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 13:33:57 -0800 Subject: [PATCH 039/139] Add sculpt demo --- example/sculpt.html | 40 +++ example/sculpt.js | 401 ++++++++++++++++++++++++ example/textures/skinHazardousarts2.jpg | Bin 0 -> 40672 bytes 3 files changed, 441 insertions(+) create mode 100644 example/sculpt.html create mode 100644 example/sculpt.js create mode 100644 example/textures/skinHazardousarts2.jpg diff --git a/example/sculpt.html b/example/sculpt.html new file mode 100644 index 000000000..67183caa3 --- /dev/null +++ b/example/sculpt.html @@ -0,0 +1,40 @@ + + + + THREE.js BVH Geometry Collect Triangles + + + + + +
+ Inspired by and Matcap texture from SculptGL. +
+ + + diff --git a/example/sculpt.js b/example/sculpt.js new file mode 100644 index 000000000..7c9ae39a1 --- /dev/null +++ b/example/sculpt.js @@ -0,0 +1,401 @@ +import Stats from 'stats.js/src/Stats'; +import * as dat from 'dat.gui'; +import * as THREE from 'three'; +import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'; +import { + acceleratedRaycast, + computeBoundsTree, + disposeBoundsTree, + CONTAINED, + INTERSECTED, + NOT_INTERSECTED, + MeshBVHVisualizer, +} from '../src/index.js'; +import "@babel/polyfill"; + +THREE.Mesh.prototype.raycast = acceleratedRaycast; +THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree; +THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; + +// TODO: +// - Reset button +// - Better brush shape +// - Multiple brush types +// - SculptGL credit +// - Better brush strokes +// - Refit based on index search +// - Generate new BVH in background and do refit after transfer +// - Fix normals +// - Fix seam down the back of the sphere +// - Simplify and tessellate buttons + +const params = { + size: 0.1, + intensity: 0.002, + flatShading: true, + depth: 10, + displayHelper: false, +}; + +let stats; +let scene, camera, renderer, controls; +let targetMesh, brush, bvhHelper; +let normalZ = new THREE.Vector3( 0, 0, 1 ); +let mouse = new THREE.Vector2(), lastMouse = new THREE.Vector2(); +let mouseState = false, lastMouseState = false; + +function init() { + + const bgColor = 0x263238 / 2; + + // renderer setup + renderer = new THREE.WebGLRenderer( { antialias: true } ); + renderer.setPixelRatio( window.devicePixelRatio ); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.setClearColor( bgColor, 1 ); + renderer.gammaOutput = true; + document.body.appendChild( renderer.domElement ); + + // scene setup + scene = new THREE.Scene(); + scene.fog = new THREE.Fog( 0x263238 / 2, 20, 60 ); + + const light = new THREE.DirectionalLight( 0xffffff, 0.5 ); + light.position.set( 1, 1, 1 ); + scene.add( light ); + scene.add( new THREE.AmbientLight( 0xffffff, 0.4 ) ); + + // geometry setup + targetMesh = new THREE.Mesh( + new THREE.SphereBufferGeometry( 1, 1000, 1000 ), + new THREE.MeshMatcapMaterial( { + wireframe: true, + flatShading: params.flatShading, + matcap: new THREE.TextureLoader().load( '../textures/skinHazardousarts2.jpg' ), + } ) ); + + targetMesh.geometry.computeBoundsTree(); + targetMesh.material.matcap.encoding = THREE.sRGBEncoding; + scene.add( targetMesh ); + + // initialize bvh helper + bvhHelper = new MeshBVHVisualizer( targetMesh, params.depth ); + bvhHelper.visible = params.displayHelper; + scene.add( bvhHelper ); + + // initialize brush shape + const brushSegments = [ new THREE.Vector3(), new THREE.Vector3( 0, 0, 1 ) ]; + for ( let i = 0; i < 50; i ++ ) { + + const nexti = i + 1; + const x1 = Math.sin( 2 * Math.PI * i / 50 ); + const y1 = Math.cos( 2 * Math.PI * i / 50 ); + + const x2 = Math.sin( 2 * Math.PI * nexti / 50 ); + const y2 = Math.cos( 2 * Math.PI * nexti / 50 ); + + brushSegments.push( + new THREE.Vector3( x1, y1, 0 ), + new THREE.Vector3( x2, y2, 0 ) + ); + + } + brush = new THREE.LineSegments(); + brush.geometry.setFromPoints( brushSegments ); + brush.material.color.set( 0xff9800 ); + scene.add( brush ); + + // camera setup + camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 ); + camera.position.set( 3, 3, 3 ); + camera.far = 100; + camera.updateProjectionMatrix(); + + controls = new OrbitControls( camera, renderer.domElement ); + controls.minDistance = 1.5; + + // stats setup + stats = new Stats(); + document.body.appendChild( stats.dom ); + + const gui = new dat.GUI(); + + const sculptFolder = gui.addFolder( 'Sculpting' ); + sculptFolder.add( params, 'size' ).min( 0.05 ).max( 0.25 ).step( 0.01 ); + sculptFolder.add( params, 'intensity' ).min( 0.001 ).max( 0.01 ).step( 0.001 ); + sculptFolder.add( params, 'flatShading' ).onChange( value => { + + targetMesh.material.flatShading = value; + targetMesh.material.needsUpdate = true; + + } ); + sculptFolder.open(); + + const helperFolder = gui.addFolder( 'BVH Helper' ); + helperFolder.add( params, 'depth' ).min( 1 ).max( 20 ).step( 1 ).onChange( d => { + + bvhHelper.depth = parseFloat( d ); + bvhHelper.update(); + + } ); + helperFolder.add( params, 'displayHelper' ).onChange( display => { + + bvhHelper.visible = display; + + } ); + helperFolder.open(); + + + gui.open(); + + controls.addEventListener( 'start', function () { + + this.active = true; + + } ); + + controls.addEventListener( 'end', function () { + + this.active = false; + + } ); + + window.addEventListener( 'resize', function () { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize( window.innerWidth, window.innerHeight ); + + }, false ); + + window.addEventListener( 'mousemove', function ( e ) { + + mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; + mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; + + } ); + + window.addEventListener( 'mousedown', e => { + + mouseState = Boolean( e.buttons & 1 ); + + } ); + + window.addEventListener( 'mouseup', e => { + + mouseState = Boolean( e.buttons & 1 ); + + } ); + + window.addEventListener( 'contextmenu', function ( e ) { + + e.preventDefault(); + + } ); + + window.addEventListener( 'wheel', function ( e ) { + + let delta = e.deltaY; + + if ( e.deltaMode === 1 ) { + + delta *= 40; + + } + + if ( e.deltaMode === 2 ) { + + delta *= 40; + + } + + params.size += delta * 0.0005; + params.size = Math.max( Math.min( params.size, 0.25 ), 0.05 ); + + gui.updateDisplay(); + + } ); + +} + +function render() { + + requestAnimationFrame( render ); + + stats.begin(); + + if ( controls.active ) { + + brush.visible = false; + + } else { + + const raycaster = new THREE.Raycaster(); + raycaster.setFromCamera( mouse, camera ); + raycaster.firstHitOnly = true; + + const hit = raycaster.intersectObject( targetMesh, true )[ 0 ]; + if ( hit ) { + + brush.visible = true; + brush.scale.set( params.size, params.size, 0.1 ); + brush.position.copy( hit.point ); + brush.quaternion.setFromUnitVectors( normalZ, hit.face.normal ); + controls.enabled = false; + + if ( mouseState || lastMouseState ) { + + const inverseMatrix = new THREE.Matrix4(); + inverseMatrix.copy( targetMesh.matrixWorld ).invert(); + + const sphere = new THREE.Sphere(); + sphere.center.copy( hit.point ).applyMatrix4( inverseMatrix ); + sphere.radius = params.size; + + const indices = []; + const tempVec = new THREE.Vector3(); + const tempVec2 = new THREE.Vector3(); + const tempVec3 = new THREE.Vector3(); + const bvh = targetMesh.geometry.boundsTree; + bvh.shapecast( + targetMesh, + box => { + + const intersects = sphere.intersectsBox( box ); + const { min, max } = box; + if ( intersects ) { + + for ( let x = 0; x <= 1; x ++ ) { + + for ( let y = 0; y <= 1; y ++ ) { + + for ( let z = 0; z <= 1; z ++ ) { + + tempVec.set( + x === 0 ? min.x : max.x, + y === 0 ? min.y : max.y, + z === 0 ? min.z : max.z + ); + if ( ! sphere.containsPoint( tempVec ) ) { + + return INTERSECTED; + + } + + } + + } + + } + + return CONTAINED; + + } + + return intersects ? INTERSECTED : NOT_INTERSECTED; + + }, + ( tri, a, b, c, contained ) => { + + if ( contained || tri.intersectsSphere( sphere ) ) { + + indices.push( a, b, c ); + + } + + return false; + + } + ); + + const indexToTriangles = {}; + const indexAttr = targetMesh.geometry.index; + const posAttr = targetMesh.geometry.attributes.position; + const normalAttr = targetMesh.geometry.attributes.normal; + const indexSet = new Set( indices ); + + tempVec2.copy( hit.point ).applyMatrix4( inverseMatrix ); + tempVec3.copy( hit.face.normal ).transformDirection( targetMesh.matrixWorld ); + indexSet.forEach( i => { + + const index = indexAttr.getX( i ); + tempVec.fromBufferAttribute( posAttr, index ); + + const dist = tempVec.distanceTo( tempVec2 ); + if ( dist > params.size ) { + + return; + + } + + const intensity = 1.0 - ( dist / params.size ); + tempVec.addScaledVector( tempVec3, intensity * params.intensity ); + posAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); + + let arr = indexToTriangles[ index ]; + if ( ! arr ) { + + arr = indexToTriangles[ index ] = []; + + } + + arr.push( ~ ~ ( i / 3 ) ); + + } ); + + if ( indices.length ) { + + console.time('NORMALS'); + const triangle = new THREE.Triangle(); + for ( const index in indexToTriangles ) { + + tempVec.set( 0, 0, 0 ); + + const arr = indexToTriangles[ index ]; + for ( const tri in arr ) { + + const i3 = tri * 3; + triangle.a.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 0 ) ); + triangle.b.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 1 ) ); + triangle.c.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 2 ) ); + + triangle.getNormal( tempVec2 ); + tempVec.add( tempVec2 ); + + } + + tempVec.multiplyScalar( 1 / arr.length ); + normalAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); + + } + console.timeEnd('NORMALS'); + + posAttr.needsUpdate = true; + normalAttr.needsUpdate = true; + + } + + + } + + } else { + + controls.enabled = true; + brush.visible = false; + + } + + } + + lastMouseState = mouseState; + lastMouse.copy( mouse ); + + renderer.render( scene, camera ); + stats.end(); + +} + + +init(); +render(); diff --git a/example/textures/skinHazardousarts2.jpg b/example/textures/skinHazardousarts2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9b705177147597115064186820e9b088a62effe9 GIT binary patch literal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xKrf)|s2(9P3w^RuK zA_#V%-x?=z#xY3oJZeF*UAB>i{{H2scu->-eGOT

Zq@7Etx%);@$t9GLX zVuQ_GpIs!6-xB-h!)=0PNE2quR$TjUk zyyYwx$_sDhG~m7?J}go9-`uz4-5J5vbSqW=EijgkzMQjH1^pQL{2XRM%LLzdF1!fE zd0jM3V%eNL(kg6n5_g4ar#0-bmYQ}#M*Iwh*Ga`vZ4|ym(T>EFL{lx*E#1(01zI7J znEY!MeXn>6RTZfAJhT2(q*OzitJg}-x4700|HwHnTj)l7!6}_(R4bTWj~?~0CDHuS zIR;%WcaPV`;+#Dj^dSC~PKdW~)OnBl$>~kt9diH1r4=gi)5jq%OKi9^N`^xyvED^C z%a?lNSLY#p6hVLaPeiw(wBYCSjLSlTSx0%Mxa%_G^RBQn zDf=4yw;AI|SbL$E<;xye*=SdXZ(%`eA+!x9i}yR9u3$O&+VP9*K_V5cZrAX9_GTlHcm8~eSB*=VS&G%Uz}ky*QITo`xIJgB1W3_uHUb0cc~ z+Lfd6RMg3pF1oE==mnAb`sUepMh4gG29LYY=}dtV!P^319GtTY_R`&0j*1G8^-_u literal 0 HcmV?d00001 From 6408091ba56031500732114c7bc1fcb7e6b9f122 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 13:34:25 -0800 Subject: [PATCH 040/139] add initial refit function --- src/MeshBVH.js | 111 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 98 insertions(+), 13 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 46020f5e7..79635ae94 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -104,34 +104,119 @@ export default class MeshBVH { } + refit( geometry ) { + + const indexArr = geometry.index.array; + const posArr = geometry.attributes.position; + let buffer, uint32Array, uint16Array; + const roots = this._roots; + for ( let i = 0, l = roots.length; i < l; i ++ ) { + + buffer = roots[ i ]; + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + _traverse( 0 ); + + } + + function _traverse( node32Index ) { + + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; + if ( isLeaf ) { + + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; + + let minx = Infinity; + let miny = Infinity; + let minz = Infinity; + let maxx = - Infinity; + let maxy = - Infinity; + let maxz = - Infinity; + for ( let i = offset, l = offset + count; i < l; i ++ ) { + + const index3 = indexArr[ i ] * 3; + const x = posArr[ index3 + 0 ]; + const y = posArr[ index3 + 1 ]; + const z = posArr[ index3 + 2 ]; + + if ( x < minx ) minx = x; + if ( x > maxx ) maxx = x; + + if ( y < miny ) miny = y; + if ( y > maxy ) maxy = y; + + if ( z < minz ) minz = z; + if ( z > maxz ) maxz = z; + + } + uint32Array[ node32Index + 0 ] = minx; + uint32Array[ node32Index + 1 ] = miny; + uint32Array[ node32Index + 2 ] = minz; + + uint32Array[ node32Index + 3 ] = maxx; + uint32Array[ node32Index + 4 ] = maxy; + uint32Array[ node32Index + 5 ] = maxz; + + } else { + + const left = node32Index + BYTES_PER_NODE / 4; + const right = uint32Array[ node32Index + 6 ]; + + _traverse( left ); + _traverse( right ); + + for ( let i = 0; i < 6; i ++ ) { + + const lValue = uint32Array[ left + i ]; + const rValue = uint32Array[ right + i ]; + if ( i < 3 ) { + + uint32Array[ node32Index + i ] = lValue < rValue ? lValue : rValue; + + } else { + + uint32Array[ node32Index + i ] = lValue > rValue ? lValue : rValue; + + } + + } + + } + + } + + } + traverse( callback, rootIndex = 0 ) { const buffer = this._roots[ rootIndex ]; const uint32Array = new Uint32Array( buffer ); const uint16Array = new Uint16Array( buffer ); - _traverseBuffer( 0 ); + _traverse( 0 ); - function _traverseBuffer( stride4Offset, depth = 0 ) { + function _traverse( node32Index, depth = 0 ) { - const stride2Offset = stride4Offset * 2; - const isLeaf = uint16Array[ stride2Offset + 15 ] === IS_LEAFNODE_FLAG; + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf ) { - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; - callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count ); + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; + callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count ); } else { - const left = stride4Offset + BYTES_PER_NODE / 4; - const right = uint32Array[ stride4Offset + 6 ]; - const splitAxis = uint32Array[ stride4Offset + 7 ]; - const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis ); + const left = node32Index + BYTES_PER_NODE / 4; + const right = uint32Array[ node32Index + 6 ]; + const splitAxis = uint32Array[ node32Index + 7 ]; + const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis ); if ( ! stopTraversal ) { - _traverseBuffer( left, depth + 1 ); - _traverseBuffer( right, depth + 1 ); + _traverse( left, depth + 1 ); + _traverse( right, depth + 1 ); } From 13452bfd1735a95658ef3e3b567c8c0446913b23 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 18:30:24 -0800 Subject: [PATCH 041/139] Fix refit function --- src/MeshBVH.js | 66 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 79635ae94..834b96573 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -107,18 +107,18 @@ export default class MeshBVH { refit( geometry ) { const indexArr = geometry.index.array; - const posArr = geometry.attributes.position; - let buffer, uint32Array, uint16Array; + const posArr = geometry.attributes.position.array; + let buffer, uint32Array, uint16Array, float32Array; const roots = this._roots; for ( let i = 0, l = roots.length; i < l; i ++ ) { buffer = roots[ i ]; uint32Array = new Uint32Array( buffer ); uint16Array = new Uint16Array( buffer ); + float32Array = new Float32Array( buffer ); _traverse( 0 ); } - function _traverse( node32Index ) { const node16Index = node32Index * 2; @@ -134,7 +134,7 @@ export default class MeshBVH { let maxx = - Infinity; let maxy = - Infinity; let maxz = - Infinity; - for ( let i = offset, l = offset + count; i < l; i ++ ) { + for ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) { const index3 = indexArr[ i ] * 3; const x = posArr[ index3 + 0 ]; @@ -151,38 +151,62 @@ export default class MeshBVH { if ( z > maxz ) maxz = z; } - uint32Array[ node32Index + 0 ] = minx; - uint32Array[ node32Index + 1 ] = miny; - uint32Array[ node32Index + 2 ] = minz; - uint32Array[ node32Index + 3 ] = maxx; - uint32Array[ node32Index + 4 ] = maxy; - uint32Array[ node32Index + 5 ] = maxz; + if ( + float32Array[ node32Index + 0 ] !== minx || + float32Array[ node32Index + 1 ] !== miny || + float32Array[ node32Index + 2 ] !== minz || + + float32Array[ node32Index + 3 ] !== maxx || + float32Array[ node32Index + 4 ] !== maxy || + float32Array[ node32Index + 5 ] !== maxz + ) { + + float32Array[ node32Index + 0 ] = minx; + float32Array[ node32Index + 1 ] = miny; + float32Array[ node32Index + 2 ] = minz; + + float32Array[ node32Index + 3 ] = maxx; + float32Array[ node32Index + 4 ] = maxy; + float32Array[ node32Index + 5 ] = maxz; + + return true; + + } else { + + return false; + + } } else { - const left = node32Index + BYTES_PER_NODE / 4; + const left = node32Index + 8; const right = uint32Array[ node32Index + 6 ]; - _traverse( left ); - _traverse( right ); - - for ( let i = 0; i < 6; i ++ ) { + const leftChange = _traverse( left ); + const rightChange = _traverse( right ); + const didChange = leftChange || rightChange; - const lValue = uint32Array[ left + i ]; - const rValue = uint32Array[ right + i ]; - if ( i < 3 ) { + if ( didChange ) { - uint32Array[ node32Index + i ] = lValue < rValue ? lValue : rValue; + for ( let i = 0; i < 3; i ++ ) { - } else { + const lefti = left + i; + const righti = right + i; + const minLeftValue = float32Array[ lefti ]; + const maxLeftValue = float32Array[ lefti + 3 ]; + const minRightValue = float32Array[ righti ]; + const maxRightValue = float32Array[ righti + 3 ]; - uint32Array[ node32Index + i ] = lValue > rValue ? lValue : rValue; + float32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue; + float32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue; } } + return didChange; + } } From 5aff1db7609dd99648a07c7041fcd6b5e15dd2b5 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 18:30:34 -0800 Subject: [PATCH 042/139] Add error if the buffer gets too big --- src/buildFunctions.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/buildFunctions.js b/src/buildFunctions.js index f882e1492..3cfc308e4 100644 --- a/src/buildFunctions.js +++ b/src/buildFunctions.js @@ -715,6 +715,12 @@ export function buildPackedTree( geo, options ) { let nextUnusedPointer; nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); + if ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) { + + throw new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' ); + + } + uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); From c6af24fcd76b0b6d711fcddb2b45d1db1acd8e04 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 19:23:33 -0800 Subject: [PATCH 043/139] sculpt update --- example/sculpt.js | 110 +++++++++++++++++++++++++++++++++------------- 1 file changed, 79 insertions(+), 31 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 7c9ae39a1..a7cea6d8a 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -2,6 +2,7 @@ import Stats from 'stats.js/src/Stats'; import * as dat from 'dat.gui'; import * as THREE from 'three'; import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'; +import { BufferGeometryUtils } from 'three/examples/jsm/utils/BufferGeometryUtils.js'; import { acceleratedRaycast, computeBoundsTree, @@ -18,31 +19,71 @@ THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree; THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; // TODO: -// - Reset button +// - Average brush orientation from multiple points // - Better brush shape // - Multiple brush types -// - SculptGL credit // - Better brush strokes -// - Refit based on index search // - Generate new BVH in background and do refit after transfer -// - Fix normals -// - Fix seam down the back of the sphere -// - Simplify and tessellate buttons + +let stats; +let scene, camera, renderer, controls; +let targetMesh, brush, bvhHelper; +let normalZ = new THREE.Vector3( 0, 0, 1 ); +let mouse = new THREE.Vector2(), lastMouse = new THREE.Vector2(); +let mouseState = false, lastMouseState = false; +let matcap; const params = { size: 0.1, + clayBrush: true, intensity: 0.002, - flatShading: true, + flatShading: false, depth: 10, displayHelper: false, }; -let stats; -let scene, camera, renderer, controls; -let targetMesh, brush, bvhHelper; -let normalZ = new THREE.Vector3( 0, 0, 1 ); -let mouse = new THREE.Vector2(), lastMouse = new THREE.Vector2(); -let mouseState = false, lastMouseState = false; +function reset() { + + if ( targetMesh ) { + + targetMesh.geometry.dispose(); + targetMesh.material.dispose(); + scene.remove( targetMesh ); + + } + + if ( ! matcap ) { + + matcap = new THREE.TextureLoader().load( '../textures/skinHazardousarts2.jpg' ); + + } + + let geometry = new THREE.IcosahedronBufferGeometry( 1, 100 ); + geometry.deleteAttribute( 'uv' ); + geometry = BufferGeometryUtils.mergeVertices( geometry ); + + geometry.computeBoundsTree(); + geometry.attributes.position.setUsage( THREE.DynamicDrawUsage ); + geometry.attributes.normal.setUsage( THREE.DynamicDrawUsage ); + + targetMesh = new THREE.Mesh( + geometry, + new THREE.MeshMatcapMaterial( { + wireframe: true, + flatShading: params.flatShading, + matcap + } ) + ); + targetMesh.material.matcap.encoding = THREE.sRGBEncoding; + scene.add( targetMesh ); + + if ( bvhHelper ) { + + bvhHelper.update(); + + } + +} function init() { @@ -66,17 +107,7 @@ function init() { scene.add( new THREE.AmbientLight( 0xffffff, 0.4 ) ); // geometry setup - targetMesh = new THREE.Mesh( - new THREE.SphereBufferGeometry( 1, 1000, 1000 ), - new THREE.MeshMatcapMaterial( { - wireframe: true, - flatShading: params.flatShading, - matcap: new THREE.TextureLoader().load( '../textures/skinHazardousarts2.jpg' ), - } ) ); - - targetMesh.geometry.computeBoundsTree(); - targetMesh.material.matcap.encoding = THREE.sRGBEncoding; - scene.add( targetMesh ); + reset(); // initialize bvh helper bvhHelper = new MeshBVHVisualizer( targetMesh, params.depth ); @@ -121,8 +152,9 @@ function init() { const gui = new dat.GUI(); const sculptFolder = gui.addFolder( 'Sculpting' ); + sculptFolder.add( params, 'clayBrush' ); sculptFolder.add( params, 'size' ).min( 0.05 ).max( 0.25 ).step( 0.01 ); - sculptFolder.add( params, 'intensity' ).min( 0.001 ).max( 0.01 ).step( 0.001 ); + sculptFolder.add( params, 'intensity' ).min( - 0.01 ).max( 0.01 ).step( 0.001 ); sculptFolder.add( params, 'flatShading' ).onChange( value => { targetMesh.material.flatShading = value; @@ -145,7 +177,13 @@ function init() { } ); helperFolder.open(); + gui.add( { reset }, 'reset' ); + gui.add( { rebuildBVH: () => { + + targetMesh.geometry.computeBoundsTree(); + bvhHelper.update(); + } }, 'rebuildBVH' ); gui.open(); controls.addEventListener( 'start', function () { @@ -244,7 +282,7 @@ function render() { brush.quaternion.setFromUnitVectors( normalZ, hit.face.normal ); controls.enabled = false; - if ( mouseState || lastMouseState ) { + if ( ( mouseState || lastMouseState ) && mouse.distanceTo( lastMouse ) > 0.001 ) { const inverseMatrix = new THREE.Matrix4(); inverseMatrix.copy( targetMesh.matrixWorld ).invert(); @@ -329,7 +367,14 @@ function render() { } - const intensity = 1.0 - ( dist / params.size ); + let intensity = 1.0 - ( dist / params.size ); + intensity *= intensity; + if ( params.clayBrush ) { + + intensity = Math.min( intensity, 0.1 ); + + } + tempVec.addScaledVector( tempVec3, intensity * params.intensity ); posAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); @@ -346,7 +391,7 @@ function render() { if ( indices.length ) { - console.time('NORMALS'); + // TODO: this can be improved const triangle = new THREE.Triangle(); for ( const index in indexToTriangles ) { @@ -355,7 +400,7 @@ function render() { const arr = indexToTriangles[ index ]; for ( const tri in arr ) { - const i3 = tri * 3; + const i3 = arr[ tri ] * 3; triangle.a.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 0 ) ); triangle.b.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 1 ) ); triangle.c.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 2 ) ); @@ -365,15 +410,18 @@ function render() { } - tempVec.multiplyScalar( 1 / arr.length ); + tempVec.normalize(); normalAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); } - console.timeEnd('NORMALS'); posAttr.needsUpdate = true; normalAttr.needsUpdate = true; + targetMesh.geometry.boundsTree.refit( targetMesh.geometry ); + + bvhHelper.update(); + } From 72703968261bfd446357ce2fbd35abec7078b4c6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 19:23:38 -0800 Subject: [PATCH 044/139] refit benchmark --- benchmark/run-benchmark.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index f20bdf833..31c1fdfa5 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -64,6 +64,20 @@ function runSuite( strategy ) { ); geometry.computeBoundsTree( options ); + runBenchmark( + + 'Refit', + null, + () => { + + geometry.boundsTree.refit( geometry ); + + }, + 3000, + 50 + + ); + runBenchmark( 'Serialize', From 02481a8d4167e5259e96b01b15d2b7a1866f217e Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 19:23:42 -0800 Subject: [PATCH 045/139] comments --- example/sculpt.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index a7cea6d8a..f1aeafd0d 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -20,8 +20,6 @@ THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; // TODO: // - Average brush orientation from multiple points -// - Better brush shape -// - Multiple brush types // - Better brush strokes // - Generate new BVH in background and do refit after transfer From ae9ac6314804fbc26b03daa1ce6dfc80cd2e641f Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 19:31:04 -0800 Subject: [PATCH 046/139] Remove `Buffer` from cast function names --- src/MeshBVH.js | 16 ++++----- src/castFunctions.js | 68 +++++++++++++++++------------------ src/castFunctions.template.js | 68 +++++++++++++++++------------------ 3 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 834b96573..f3ae978ea 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -5,10 +5,10 @@ import { OrientedBox } from './Utils/OrientedBox.js'; import { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js'; import { setTriangle } from './Utils/TriangleUtils.js'; import { - raycastBuffer, - raycastFirstBuffer, - shapecastBuffer, - intersectsGeometryBuffer, + raycast, + raycastFirst, + shapecast, + intersectsGeometry, setBuffer, clearBuffer, } from './castFunctions.js'; @@ -256,7 +256,7 @@ export default class MeshBVH { for ( const root of this._roots ) { setBuffer( root ); - raycastBuffer( 0, mesh, raycaster, ray, intersects ); + raycast( 0, mesh, raycaster, ray, intersects ); } @@ -270,7 +270,7 @@ export default class MeshBVH { for ( const root of this._roots ) { setBuffer( root ); - const result = raycastFirstBuffer( 0, mesh, raycaster, ray ); + const result = raycastFirst( 0, mesh, raycaster, ray ); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -292,7 +292,7 @@ export default class MeshBVH { for ( const root of this._roots ) { setBuffer( root ); - result = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh ); + result = intersectsGeometry( 0, mesh, geometry, geomToMesh ); if ( result ) { @@ -314,7 +314,7 @@ export default class MeshBVH { for ( const root of this._roots ) { setBuffer( root ); - result = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); + result = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); if ( result ) { diff --git a/src/castFunctions.js b/src/castFunctions.js index 48381515f..052f5dc57 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -14,7 +14,7 @@ const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { +export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -29,16 +29,16 @@ export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { } else { const leftIndex = nodeIndex32 + 8; - if ( intersectRayBuffer( leftIndex, float32Array, ray, boxIntersection ) ) { + if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { - raycastBuffer( leftIndex, mesh, raycaster, ray, intersects ); + raycast( leftIndex, mesh, raycaster, ray, intersects ); } const rightIndex = uint32Array[ nodeIndex32 + 6 ]; - if ( intersectRayBuffer( rightIndex, float32Array, ray, boxIntersection ) ) { + if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { - raycastBuffer( rightIndex, mesh, raycaster, ray, intersects ); + raycast( rightIndex, mesh, raycaster, ray, intersects ); } @@ -46,7 +46,7 @@ export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { } -export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { +export function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -80,8 +80,8 @@ export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { } - const c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection ); - const c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null; + const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); + const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; // if we got an intersection in the first node and it's closer than the second node's bounding // box, we don't need to consider the second node because it couldn't possibly be a better result @@ -103,8 +103,8 @@ export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { // either there was no intersection in the first node, or there could still be a closer // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection ); - const c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null; + const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); + const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; if ( c1Result && c2Result ) { @@ -120,7 +120,7 @@ export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { } -export const shapecastBuffer = ( function () { +export const shapecast = ( function () { const _triangle = new SeparatingAxisTriangle(); const _cachedBox1 = new Box3(); @@ -155,7 +155,7 @@ export const shapecastBuffer = ( function () { } - return function shapecastBuffer( nodeIndex32, + return function shapecast( nodeIndex32, mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, @@ -168,7 +168,7 @@ export const shapecastBuffer = ( function () { // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents - function getLeftOffsetBuffer( nodeIndex32 ) { + function getLeftOffset( nodeIndex32 ) { let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -184,7 +184,7 @@ export const shapecastBuffer = ( function () { } - function getRightEndOffsetBuffer( nodeIndex32 ) { + function getRightEndOffset( nodeIndex32 ) { let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -227,8 +227,8 @@ export const shapecastBuffer = ( function () { box2 = cachedBox2; // bounding data is not offset - arrayToBoxBuffer( c1, float32Array, box1 ); - arrayToBoxBuffer( c2, float32Array, box2 ); + arrayToBox( c1, float32Array, box1 ); + arrayToBox( c2, float32Array, box2 ); score1 = nodeScoreFunc( box1 ); score2 = nodeScoreFunc( box2 ); @@ -253,7 +253,7 @@ export const shapecastBuffer = ( function () { if ( ! box1 ) { box1 = cachedBox1; - arrayToBoxBuffer( c1, float32Array, box1 ); + arrayToBox( c1, float32Array, box1 ); } @@ -264,8 +264,8 @@ export const shapecastBuffer = ( function () { if ( c1Intersection === CONTAINED ) { const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c1 ); - const end = getRightEndOffsetBuffer( c1 ); + const offset = getLeftOffset( c1 ); + const end = getRightEndOffset( c1 ); const count = end - offset; c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); @@ -274,7 +274,7 @@ export const shapecastBuffer = ( function () { c1StopTraversal = c1Intersection && - shapecastBuffer( + shapecast( c1, mesh, intersectsBoundsFunc, @@ -293,7 +293,7 @@ export const shapecastBuffer = ( function () { // Check box 2 intersection // cached box2 will have been overwritten by previous traversal box2 = cachedBox2; - arrayToBoxBuffer( c2, float32Array, box2 ); + arrayToBox( c2, float32Array, box2 ); const isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF ); const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); @@ -302,8 +302,8 @@ export const shapecastBuffer = ( function () { if ( c2Intersection === CONTAINED ) { const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c2 ); - const end = getRightEndOffsetBuffer( c2 ); + const offset = getLeftOffset( c2 ); + const end = getRightEndOffset( c2 ); const count = end - offset; c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); @@ -312,7 +312,7 @@ export const shapecastBuffer = ( function () { c2StopTraversal = c2Intersection && - shapecastBuffer( + shapecast( c2, mesh, intersectsBoundsFunc, @@ -336,7 +336,7 @@ export const shapecastBuffer = ( function () { } )(); -export const intersectsGeometryBuffer = ( function () { +export const intersectsGeometry = ( function () { const triangle = new SeparatingAxisTriangle(); const triangle2 = new SeparatingAxisTriangle(); @@ -346,7 +346,7 @@ export const intersectsGeometryBuffer = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometryBuffer( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { + return function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -384,7 +384,7 @@ export const intersectsGeometryBuffer = ( function () { if ( geometry.boundsTree ) { - arrayToBoxBuffer( nodeIndex32, float32Array, obb2 ); + arrayToBox( nodeIndex32, float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); @@ -449,17 +449,17 @@ export const intersectsGeometryBuffer = ( function () { const left = nodeIndex32 + 8; const right = uint32Array[ nodeIndex32 + 6 ]; - arrayToBoxBuffer( left, float32Array, boundingBox ); + arrayToBox( left, float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; - arrayToBoxBuffer( right, float32Array, boundingBox ); + arrayToBox( right, float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); if ( rightIntersection ) return true; @@ -471,9 +471,9 @@ export const intersectsGeometryBuffer = ( function () { } )(); -function intersectRayBuffer( nodeIndex32, array, ray, target ) { +function intersectRay( nodeIndex32, array, ray, target ) { - arrayToBoxBuffer( nodeIndex32, array, boundingBox ); + arrayToBox( nodeIndex32, array, boundingBox ); return ray.intersectBox( boundingBox, target ); } @@ -513,7 +513,7 @@ export function clearBuffer() { } -function arrayToBoxBuffer( nodeIndex32, array, target ) { +function arrayToBox( nodeIndex32, array, target ) { target.min.x = array[ nodeIndex32 ]; target.min.y = array[ nodeIndex32 + 1 ]; diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 41e02e77d..7eb002650 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -16,7 +16,7 @@ const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { +export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -31,16 +31,16 @@ export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { } else { const leftIndex = LEFT_NODE( nodeIndex32 ); - if ( intersectRayBuffer( leftIndex, float32Array, ray, boxIntersection ) ) { + if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { - raycastBuffer( leftIndex, mesh, raycaster, ray, intersects ); + raycast( leftIndex, mesh, raycaster, ray, intersects ); } const rightIndex = RIGHT_NODE( nodeIndex32 ); - if ( intersectRayBuffer( rightIndex, float32Array, ray, boxIntersection ) ) { + if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { - raycastBuffer( rightIndex, mesh, raycaster, ray, intersects ); + raycast( rightIndex, mesh, raycaster, ray, intersects ); } @@ -48,7 +48,7 @@ export function raycastBuffer( nodeIndex32, mesh, raycaster, ray, intersects ) { } -export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { +export function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -82,8 +82,8 @@ export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { } - const c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection ); - const c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null; + const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); + const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; // if we got an intersection in the first node and it's closer than the second node's bounding // box, we don't need to consider the second node because it couldn't possibly be a better result @@ -105,8 +105,8 @@ export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { // either there was no intersection in the first node, or there could still be a closer // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection ); - const c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null; + const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); + const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; if ( c1Result && c2Result ) { @@ -122,7 +122,7 @@ export function raycastFirstBuffer( nodeIndex32, mesh, raycaster, ray ) { } -export const shapecastBuffer = ( function () { +export const shapecast = ( function () { const _triangle = new SeparatingAxisTriangle(); const _cachedBox1 = new Box3(); @@ -157,7 +157,7 @@ export const shapecastBuffer = ( function () { } - return function shapecastBuffer( nodeIndex32, + return function shapecast( nodeIndex32, mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, @@ -170,7 +170,7 @@ export const shapecastBuffer = ( function () { // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents - function getLeftOffsetBuffer( nodeIndex32 ) { + function getLeftOffset( nodeIndex32 ) { let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -186,7 +186,7 @@ export const shapecastBuffer = ( function () { } - function getRightEndOffsetBuffer( nodeIndex32 ) { + function getRightEndOffset( nodeIndex32 ) { let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -229,8 +229,8 @@ export const shapecastBuffer = ( function () { box2 = cachedBox2; // bounding data is not offset - arrayToBoxBuffer( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 ); - arrayToBoxBuffer( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); + arrayToBox( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 ); + arrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); score1 = nodeScoreFunc( box1 ); score2 = nodeScoreFunc( box2 ); @@ -255,7 +255,7 @@ export const shapecastBuffer = ( function () { if ( ! box1 ) { box1 = cachedBox1; - arrayToBoxBuffer( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 ); + arrayToBox( BOUNDING_DATA_INDEX( c1 ), float32Array, box1 ); } @@ -266,8 +266,8 @@ export const shapecastBuffer = ( function () { if ( c1Intersection === CONTAINED ) { const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c1 ); - const end = getRightEndOffsetBuffer( c1 ); + const offset = getLeftOffset( c1 ); + const end = getRightEndOffset( c1 ); const count = end - offset; c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); @@ -276,7 +276,7 @@ export const shapecastBuffer = ( function () { c1StopTraversal = c1Intersection && - shapecastBuffer( + shapecast( c1, mesh, intersectsBoundsFunc, @@ -295,7 +295,7 @@ export const shapecastBuffer = ( function () { // Check box 2 intersection // cached box2 will have been overwritten by previous traversal box2 = cachedBox2; - arrayToBoxBuffer( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); + arrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); const isC2Leaf = IS_LEAF( c2 ); const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); @@ -304,8 +304,8 @@ export const shapecastBuffer = ( function () { if ( c2Intersection === CONTAINED ) { const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c2 ); - const end = getRightEndOffsetBuffer( c2 ); + const offset = getLeftOffset( c2 ); + const end = getRightEndOffset( c2 ); const count = end - offset; c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); @@ -314,7 +314,7 @@ export const shapecastBuffer = ( function () { c2StopTraversal = c2Intersection && - shapecastBuffer( + shapecast( c2, mesh, intersectsBoundsFunc, @@ -338,7 +338,7 @@ export const shapecastBuffer = ( function () { } )(); -export const intersectsGeometryBuffer = ( function () { +export const intersectsGeometry = ( function () { const triangle = new SeparatingAxisTriangle(); const triangle2 = new SeparatingAxisTriangle(); @@ -348,7 +348,7 @@ export const intersectsGeometryBuffer = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometryBuffer( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { + return function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -386,7 +386,7 @@ export const intersectsGeometryBuffer = ( function () { if ( geometry.boundsTree ) { - arrayToBoxBuffer( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 ); + arrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); @@ -451,17 +451,17 @@ export const intersectsGeometryBuffer = ( function () { const left = nodeIndex32 + 8; const right = uint32Array[ nodeIndex32 + 6 ]; - arrayToBoxBuffer( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox ); + arrayToBox( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; - arrayToBoxBuffer( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox ); + arrayToBox( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); if ( rightIntersection ) return true; @@ -473,9 +473,9 @@ export const intersectsGeometryBuffer = ( function () { } )(); -function intersectRayBuffer( nodeIndex32, array, ray, target ) { +function intersectRay( nodeIndex32, array, ray, target ) { - arrayToBoxBuffer( nodeIndex32, array, boundingBox ); + arrayToBox( nodeIndex32, array, boundingBox ); return ray.intersectBox( boundingBox, target ); } @@ -515,7 +515,7 @@ export function clearBuffer() { } -function arrayToBoxBuffer( nodeIndex32, array, target ) { +function arrayToBox( nodeIndex32, array, target ) { target.min.x = array[ nodeIndex32 ]; target.min.y = array[ nodeIndex32 + 1 ]; From 5e77273111807a050c9409c747698434c42e83ed Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 21:04:02 -0800 Subject: [PATCH 047/139] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 08baa3456..d477b770b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Casting 500 rays against an 80,000 polygon model at 60fps! [Shape intersection demo](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/shapecast.html) +[Sculpting demo](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/sculpt.html) + [Triangle painting demo](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/collectTriangles.html) [Distance comparison demo](https://gkjohnson.github.io/three-mesh-bvh/example/bundle/distancecast.html) @@ -352,6 +354,14 @@ A generalized cast function that can be used to implement intersection logic for `orderNodesFunc` takes the axis aligned bounding box representing an internal node local to the bvh and returns a score or distance representing the distance to the shape being intersected with. The shape with the lowest score is traversed first. +### .refit + +```js +refit( geometry : BufferGeometry ) : void +``` + +Refit the node bounds to the current triangle positions. This is quicker than regenerating a new BVH but will not be optimal after significant changes to the vertice. + ## SerializedBVH ### .roots From 3d1e81cd82d7917892d3517b8bd5ee642f6eb2c7 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 22:02:27 -0800 Subject: [PATCH 048/139] update sculpt brush --- example/sculpt.js | 132 +++++++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 54 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index f1aeafd0d..95a8689ab 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -18,11 +18,6 @@ THREE.Mesh.prototype.raycast = acceleratedRaycast; THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree; THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; -// TODO: -// - Average brush orientation from multiple points -// - Better brush strokes -// - Generate new BVH in background and do refit after transfer - let stats; let scene, camera, renderer, controls; let targetMesh, brush, bvhHelper; @@ -280,44 +275,41 @@ function render() { brush.quaternion.setFromUnitVectors( normalZ, hit.face.normal ); controls.enabled = false; - if ( ( mouseState || lastMouseState ) && mouse.distanceTo( lastMouse ) > 0.001 ) { - - const inverseMatrix = new THREE.Matrix4(); - inverseMatrix.copy( targetMesh.matrixWorld ).invert(); - const sphere = new THREE.Sphere(); - sphere.center.copy( hit.point ).applyMatrix4( inverseMatrix ); - sphere.radius = params.size; + const inverseMatrix = new THREE.Matrix4(); + inverseMatrix.copy( targetMesh.matrixWorld ).invert(); - const indices = []; - const tempVec = new THREE.Vector3(); - const tempVec2 = new THREE.Vector3(); - const tempVec3 = new THREE.Vector3(); - const bvh = targetMesh.geometry.boundsTree; - bvh.shapecast( - targetMesh, - box => { + const sphere = new THREE.Sphere(); + sphere.center.copy( hit.point ).applyMatrix4( inverseMatrix ); + sphere.radius = params.size; - const intersects = sphere.intersectsBox( box ); - const { min, max } = box; - if ( intersects ) { + const indices = []; + const tempVec = new THREE.Vector3(); + const tempVec2 = new THREE.Vector3(); + const normal = new THREE.Vector3(); + const bvh = targetMesh.geometry.boundsTree; + bvh.shapecast( + targetMesh, + box => { - for ( let x = 0; x <= 1; x ++ ) { + const intersects = sphere.intersectsBox( box ); + const { min, max } = box; + if ( intersects ) { - for ( let y = 0; y <= 1; y ++ ) { + for ( let x = 0; x <= 1; x ++ ) { - for ( let z = 0; z <= 1; z ++ ) { + for ( let y = 0; y <= 1; y ++ ) { - tempVec.set( - x === 0 ? min.x : max.x, - y === 0 ? min.y : max.y, - z === 0 ? min.z : max.z - ); - if ( ! sphere.containsPoint( tempVec ) ) { + for ( let z = 0; z <= 1; z ++ ) { - return INTERSECTED; + tempVec.set( + x === 0 ? min.x : max.x, + y === 0 ? min.y : max.y, + z === 0 ? min.z : max.z + ); + if ( ! sphere.containsPoint( tempVec ) ) { - } + return INTERSECTED; } @@ -325,34 +317,62 @@ function render() { } - return CONTAINED; - } - return intersects ? INTERSECTED : NOT_INTERSECTED; + return CONTAINED; - }, - ( tri, a, b, c, contained ) => { + } - if ( contained || tri.intersectsSphere( sphere ) ) { + return intersects ? INTERSECTED : NOT_INTERSECTED; - indices.push( a, b, c ); + }, + ( tri, a, b, c, contained ) => { - } + if ( contained || tri.intersectsSphere( sphere ) ) { - return false; + indices.push( a, b, c ); } - ); - const indexToTriangles = {}; - const indexAttr = targetMesh.geometry.index; - const posAttr = targetMesh.geometry.attributes.position; - const normalAttr = targetMesh.geometry.attributes.normal; - const indexSet = new Set( indices ); + return false; - tempVec2.copy( hit.point ).applyMatrix4( inverseMatrix ); - tempVec3.copy( hit.face.normal ).transformDirection( targetMesh.matrixWorld ); + } + ); + const indexAttr = targetMesh.geometry.index; + const posAttr = targetMesh.geometry.attributes.position; + const normalAttr = targetMesh.geometry.attributes.normal; + const indexSet = new Set( indices ); + tempVec2.copy( hit.point ).applyMatrix4( inverseMatrix ); + indexSet.forEach( i => { + + const index = indexAttr.getX( i ); + tempVec.fromBufferAttribute( posAttr, index ); + + const dist = tempVec.distanceTo( tempVec2 ); + if ( dist > params.size ) { + + return; + + } + + tempVec.fromBufferAttribute( normalAttr, index ); + normal.add( tempVec ); + + } ); + normal.normalize(); + brush.quaternion.setFromUnitVectors( normalZ, normal ); + + const dx = ( mouse.x - lastMouse.x ) * window.innerWidth * window.devicePixelRatio; + const dy = ( mouse.y - lastMouse.y ) * window.innerHeight * window.devicePixelRatio; + const dist = Math.sqrt( dx * dx + dy * dy ); + + if ( ! ( mouseState || lastMouseState ) ) { + + lastMouse.copy( mouse ); + + } else if ( dist > params.size * 50 ) { + + const indexToTriangles = {}; indexSet.forEach( i => { const index = indexAttr.getX( i ); @@ -371,9 +391,13 @@ function render() { intensity = Math.min( intensity, 0.1 ); + } else { + + intensity *= 0.5; + } - tempVec.addScaledVector( tempVec3, intensity * params.intensity ); + tempVec.addScaledVector( normal, intensity * params.intensity ); posAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); let arr = indexToTriangles[ index ]; @@ -421,7 +445,7 @@ function render() { bvhHelper.update(); } - + lastMouse.copy( mouse ); } @@ -429,13 +453,13 @@ function render() { controls.enabled = true; brush.visible = false; + lastMouse.copy( mouse ); } } lastMouseState = mouseState; - lastMouse.copy( mouse ); renderer.render( scene, camera ); stats.end(); From a6d8a8f276cf6e414fa6a511229acff3346a05b0 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 22:12:17 -0800 Subject: [PATCH 049/139] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e352084d..4e4923f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## Unreleased +### Added +- `MeshBVH.refit` function to refit the bounds to modified vertices. + ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. - Use `type: module` in package.json to enable use of es6 modules in node. From c5a67d009fadcd1cfc640f56a08e2e5fb8d9418f Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 22:33:17 -0800 Subject: [PATCH 050/139] remove wireframe --- example/sculpt.js | 1 - 1 file changed, 1 deletion(-) diff --git a/example/sculpt.js b/example/sculpt.js index 95a8689ab..fea0199da 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -62,7 +62,6 @@ function reset() { targetMesh = new THREE.Mesh( geometry, new THREE.MeshMatcapMaterial( { - wireframe: true, flatShading: params.flatShading, matcap } ) From 44def87aeee9c1a10ac621dcbe56be25c697a249 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 4 Mar 2021 23:33:51 -0800 Subject: [PATCH 051/139] add sculpt build --- example/bundle/sculpt.493e9c78.js | 573 ++++++++++++++++++++++++++++++ example/bundle/sculpt.html | 1 + 2 files changed, 574 insertions(+) create mode 100644 example/bundle/sculpt.493e9c78.js create mode 100644 example/bundle/sculpt.html diff --git a/example/bundle/sculpt.493e9c78.js b/example/bundle/sculpt.493e9c78.js new file mode 100644 index 000000000..6238e6f2d --- /dev/null +++ b/example/bundle/sculpt.493e9c78.js @@ -0,0 +1,573 @@ +parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c0?r:o)(t)}; +},{}],"vfEH":[function(require,module,exports) { +var e=require("./_to-integer"),r=Math.max,t=Math.min;module.exports=function(n,a){return(n=e(n))<0?r(n+a,0):t(n,a)}; +},{"./_to-integer":"yjVO"}],"dJBs":[function(require,module,exports) { +var e=require("./_to-integer"),r=Math.min;module.exports=function(t){return t>0?r(e(t),9007199254740991):0}; +},{"./_to-integer":"yjVO"}],"Oppn":[function(require,module,exports) { +"use strict";var e=require("./_to-object"),t=require("./_to-absolute-index"),i=require("./_to-length");module.exports=[].copyWithin||function(r,o){var n=e(this),u=i(n.length),h=t(r,u),l=t(o,u),d=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===d?u:t(d,u))-l,u-h),a=1;for(l0;)l in n?n[h]=n[l]:delete n[h],h+=a,l+=a;return n}; +},{"./_to-object":"rfVX","./_to-absolute-index":"vfEH","./_to-length":"dJBs"}],"AIP1":[function(require,module,exports) { +var e=require("./_shared")("wks"),r=require("./_uid"),o=require("./_global").Symbol,u="function"==typeof o,i=module.exports=function(i){return e[i]||(e[i]=u&&o[i]||(u?o:r)("Symbol."+i))};i.store=e; +},{"./_shared":"zGcK","./_uid":"U49f","./_global":"qf4T"}],"Z7eD":[function(require,module,exports) { +var e=require("./_wks")("unscopables"),r=Array.prototype;null==r[e]&&require("./_hide")(r,e,{}),module.exports=function(o){r[e][o]=!0}; +},{"./_wks":"AIP1","./_hide":"NXbe"}],"tWTB":[function(require,module,exports) { +var r=require("./_export");r(r.P,"Array",{copyWithin:require("./_array-copy-within")}),require("./_add-to-unscopables")("copyWithin"); +},{"./_export":"izCb","./_array-copy-within":"Oppn","./_add-to-unscopables":"Z7eD"}],"hphS":[function(require,module,exports) { +"use strict";var e=require("./_to-object"),t=require("./_to-absolute-index"),r=require("./_to-length");module.exports=function(o){for(var i=e(this),u=r(i.length),n=arguments.length,d=t(n>1?arguments[1]:void 0,u),l=n>2?arguments[2]:void 0,s=void 0===l?u:t(l,u);s>d;)i[d++]=o;return i}; +},{"./_to-object":"rfVX","./_to-absolute-index":"vfEH","./_to-length":"dJBs"}],"hUQ6":[function(require,module,exports) { +var r=require("./_export");r(r.P,"Array",{fill:require("./_array-fill")}),require("./_add-to-unscopables")("fill"); +},{"./_export":"izCb","./_array-fill":"hphS","./_add-to-unscopables":"Z7eD"}],"Z5df":[function(require,module,exports) { +var r={}.toString;module.exports=function(t){return r.call(t).slice(8,-1)}; +},{}],"nGau":[function(require,module,exports) { +var e=require("./_cof");module.exports=Object("z").propertyIsEnumerable(0)?Object:function(r){return"String"==e(r)?r.split(""):Object(r)}; +},{"./_cof":"Z5df"}],"JTrm":[function(require,module,exports) { +var r=require("./_cof");module.exports=Array.isArray||function(e){return"Array"==r(e)}; +},{"./_cof":"Z5df"}],"NNbH":[function(require,module,exports) { +var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("species");module.exports=function(i){var t;return e(i)&&("function"!=typeof(t=i.constructor)||t!==Array&&!e(t.prototype)||(t=void 0),r(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}; +},{"./_is-object":"M7z6","./_is-array":"JTrm","./_wks":"AIP1"}],"igas":[function(require,module,exports) { +var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)}; +},{"./_array-species-constructor":"NNbH"}],"AuPh":[function(require,module,exports) { +var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; +},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); +},{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); +},{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"emcv":[function(require,module,exports) { +"use strict";var r=require("./_is-array"),e=require("./_is-object"),i=require("./_to-length"),t=require("./_ctx"),o=require("./_wks")("isConcatSpreadable");function u(s,a,n,c,f,l,q,_){for(var d,h,p=f,v=0,b=!!q&&t(q,_,3);v0)p=u(s,a,d,i(d.length),p,l-1)-1;else{if(p>=9007199254740991)throw TypeError();s[p]=d}p++}v++}return p}module.exports=u; +},{"./_is-array":"JTrm","./_is-object":"M7z6","./_to-length":"dJBs","./_ctx":"E3Kh","./_wks":"AIP1"}],"I8vV":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_flatten-into-array"),t=require("./_to-object"),a=require("./_to-length"),i=require("./_a-function"),u=require("./_array-species-create");r(r.P,"Array",{flatMap:function(r){var n,o,c=t(this);return i(r),n=a(c.length),o=u(c,0),e(o,c,c,n,0,1,r,arguments[1]),o}}),require("./_add-to-unscopables")("flatMap"); +},{"./_export":"izCb","./_flatten-into-array":"emcv","./_to-object":"rfVX","./_to-length":"dJBs","./_a-function":"kYjc","./_array-species-create":"igas","./_add-to-unscopables":"Z7eD"}],"RnOJ":[function(require,module,exports) { +var r=require("./_an-object");module.exports=function(t,e,o,a){try{return a?e(r(o)[0],o[1]):e(o)}catch(n){var c=t.return;throw void 0!==c&&r(c.call(t)),n}}; +},{"./_an-object":"eT53"}],"JO4d":[function(require,module,exports) { +module.exports={}; +},{}],"B0pB":[function(require,module,exports) { +var r=require("./_iterators"),e=require("./_wks")("iterator"),t=Array.prototype;module.exports=function(o){return void 0!==o&&(r.Array===o||t[e]===o)}; +},{"./_iterators":"JO4d","./_wks":"AIP1"}],"JCwR":[function(require,module,exports) { +"use strict";var e=require("./_object-dp"),r=require("./_property-desc");module.exports=function(t,i,o){i in t?e.f(t,i,r(0,o)):t[i]=o}; +},{"./_object-dp":"nw8e","./_property-desc":"uJ6d"}],"GM7B":[function(require,module,exports) { +var e=require("./_cof"),t=require("./_wks")("toStringTag"),n="Arguments"==e(function(){return arguments}()),r=function(e,t){try{return e[t]}catch(n){}};module.exports=function(u){var o,c,i;return void 0===u?"Undefined":null===u?"Null":"string"==typeof(c=r(o=Object(u),t))?c:n?e(o):"Object"==(i=e(o))&&"function"==typeof o.callee?"Arguments":i}; +},{"./_cof":"Z5df","./_wks":"AIP1"}],"ia42":[function(require,module,exports) { +var r=require("./_classof"),e=require("./_wks")("iterator"),t=require("./_iterators");module.exports=require("./_core").getIteratorMethod=function(o){if(null!=o)return o[e]||o["@@iterator"]||t[r(o)]}; +},{"./_classof":"GM7B","./_wks":"AIP1","./_iterators":"JO4d","./_core":"ss9A"}],"md62":[function(require,module,exports) { +var r=require("./_wks")("iterator"),t=!1;try{var n=[7][r]();n.return=function(){t=!0},Array.from(n,function(){throw 2})}catch(e){}module.exports=function(n,u){if(!u&&!t)return!1;var o=!1;try{var c=[7],a=c[r]();a.next=function(){return{done:o=!0}},c[r]=function(){return a},n(c)}catch(e){}return o}; +},{"./_wks":"AIP1"}],"RRcs":[function(require,module,exports) { +"use strict";var e=require("./_ctx"),r=require("./_export"),t=require("./_to-object"),i=require("./_iter-call"),o=require("./_is-array-iter"),u=require("./_to-length"),n=require("./_create-property"),a=require("./core.get-iterator-method");r(r.S+r.F*!require("./_iter-detect")(function(e){Array.from(e)}),"Array",{from:function(r){var l,c,f,q,_=t(r),h="function"==typeof this?this:Array,v=arguments.length,y=v>1?arguments[1]:void 0,d=void 0!==y,s=0,g=a(_);if(d&&(y=e(y,v>2?arguments[2]:void 0,2)),null==g||h==Array&&o(g))for(c=new h(l=u(_.length));l>s;s++)n(c,s,d?y(_[s],s):_[s]);else for(q=g.call(_),c=new h;!(f=q.next()).done;s++)n(c,s,d?i(q,y,[f.value,s],!0):f.value);return c.length=s,c}}); +},{"./_ctx":"E3Kh","./_export":"izCb","./_to-object":"rfVX","./_iter-call":"RnOJ","./_is-array-iter":"B0pB","./_to-length":"dJBs","./_create-property":"JCwR","./core.get-iterator-method":"ia42","./_iter-detect":"md62"}],"g6sb":[function(require,module,exports) { +var e=require("./_iobject"),r=require("./_defined");module.exports=function(i){return e(r(i))}; +},{"./_iobject":"nGau","./_defined":"BjjL"}],"Ca7J":[function(require,module,exports) { +var e=require("./_to-iobject"),r=require("./_to-length"),t=require("./_to-absolute-index");module.exports=function(n){return function(i,o,u){var f,l=e(i),a=r(l.length),c=t(u,a);if(n&&o!=o){for(;a>c;)if((f=l[c++])!=f)return!0}else for(;a>c;c++)if((n||c in l)&&l[c]===o)return n||c||0;return!n&&-1}}; +},{"./_to-iobject":"g6sb","./_to-length":"dJBs","./_to-absolute-index":"vfEH"}],"TLss":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-includes")(!0);r(r.P,"Array",{includes:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")("includes"); +},{"./_export":"izCb","./_array-includes":"Ca7J","./_add-to-unscopables":"Z7eD"}],"x8b3":[function(require,module,exports) { +module.exports=function(e,n){return{value:n,done:!!e}}; +},{}],"NaGB":[function(require,module,exports) { +var e=require("./_shared")("keys"),r=require("./_uid");module.exports=function(u){return e[u]||(e[u]=r(u))}; +},{"./_shared":"zGcK","./_uid":"U49f"}],"vL0Z":[function(require,module,exports) { +var r=require("./_has"),e=require("./_to-iobject"),u=require("./_array-includes")(!1),i=require("./_shared-key")("IE_PROTO");module.exports=function(o,a){var n,s=e(o),t=0,h=[];for(n in s)n!=i&&r(s,n)&&h.push(n);for(;a.length>t;)r(s,n=a[t++])&&(~u(h,n)||h.push(n));return h}; +},{"./_has":"uHgd","./_to-iobject":"g6sb","./_array-includes":"Ca7J","./_shared-key":"NaGB"}],"bbv4":[function(require,module,exports) { +module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","); +},{}],"U9a7":[function(require,module,exports) { +var e=require("./_object-keys-internal"),r=require("./_enum-bug-keys");module.exports=Object.keys||function(u){return e(u,r)}; +},{"./_object-keys-internal":"vL0Z","./_enum-bug-keys":"bbv4"}],"MiMz":[function(require,module,exports) { +var e=require("./_object-dp"),r=require("./_an-object"),t=require("./_object-keys");module.exports=require("./_descriptors")?Object.defineProperties:function(o,i){r(o);for(var u,c=t(i),n=c.length,s=0;n>s;)e.f(o,u=c[s++],i[u]);return o}; +},{"./_object-dp":"nw8e","./_an-object":"eT53","./_object-keys":"U9a7","./_descriptors":"P9Ib"}],"xjB1":[function(require,module,exports) { +var e=require("./_global").document;module.exports=e&&e.documentElement; +},{"./_global":"qf4T"}],"sYaK":[function(require,module,exports) { +var e=require("./_an-object"),r=require("./_object-dps"),t=require("./_enum-bug-keys"),n=require("./_shared-key")("IE_PROTO"),o=function(){},i="prototype",u=function(){var e,r=require("./_dom-create")("iframe"),n=t.length;for(r.style.display="none",require("./_html").appendChild(r),r.src="javascript:",(e=r.contentWindow.document).open(),e.write(" \ No newline at end of file From 781d4cebb58dffe3e17651766173f504702d4673 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 5 Mar 2021 00:01:00 -0800 Subject: [PATCH 052/139] title --- example/sculpt.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/sculpt.html b/example/sculpt.html index 67183caa3..1d5f7849d 100644 --- a/example/sculpt.html +++ b/example/sculpt.html @@ -1,7 +1,7 @@ - THREE.js BVH Geometry Collect Triangles + THREE.js BVH Geometry Sculpting

Inspired by and Matcap texture from SculptGL.
\ No newline at end of file + + + + THREE.js BVH Geometry Sculpting + + + + + +
+ Inspired by and Matcap texture from SculptGL. +
+ + + From c1eb85a565321b1b1adfa984297e1a31a8c8fcd9 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sat, 6 Mar 2021 10:32:33 -0800 Subject: [PATCH 069/139] lint fix --- example/sculpt.js | 1 + src/MeshBVH.js | 1 + 2 files changed, 2 insertions(+) diff --git a/example/sculpt.js b/example/sculpt.js index 30cb3ab6b..2d01c6534 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -134,6 +134,7 @@ function init() { ); } + brush = new THREE.LineSegments(); brush.geometry.setFromPoints( brushSegments ); brush.material.color.set( 0xfb8c00 ); diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 81ac38b06..4f48a7610 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -119,6 +119,7 @@ export default class MeshBVH { _traverse( 0 ); } + function _traverse( node32Index ) { const node16Index = node32Index * 2; From e33b0b7c0279aa2da6239a3b1134248a43e158f5 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sat, 6 Mar 2021 10:52:40 -0800 Subject: [PATCH 070/139] update lgtm yml --- lgtm.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lgtm.yml b/lgtm.yml index bd29f1aba..b1022d86b 100644 --- a/lgtm.yml +++ b/lgtm.yml @@ -1,5 +1,3 @@ path_classifiers: template: - - "**/*.template.js" - generated: - - exclude: src/ + - src/*.template.js From 0b74ba6295cfd929189ddeb6ff3f052a710546ac Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sat, 6 Mar 2021 16:23:13 -0800 Subject: [PATCH 071/139] better sculpting, multiple steps --- example/sculpt.js | 55 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 2d01c6534..3788ada69 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -31,7 +31,7 @@ const params = { size: 0.1, brush: 'clay', intensity: 50, - maxSteps: 1, + maxSteps: 20, invert: false, flatShading: false, @@ -69,6 +69,7 @@ function reset() { geometry.attributes.normal.setUsage( THREE.DynamicDrawUsage ); geometry.computeBoundsTree(); + // disable frustum culling because the verts will be updated targetMesh = new THREE.Mesh( geometry, new THREE.MeshMatcapMaterial( { @@ -77,6 +78,7 @@ function reset() { } ) ); targetMesh.material.matcap.encoding = THREE.sRGBEncoding; + targetMesh.frustumCulled = false; scene.add( targetMesh ); // initialize bvh helper @@ -159,7 +161,7 @@ function init() { sculptFolder.add( params, 'brush', [ 'normal', 'clay', 'flatten' ] ); sculptFolder.add( params, 'size' ).min( 0.025 ).max( 0.25 ).step( 0.005 ); sculptFolder.add( params, 'intensity' ).min( 1 ).max( 100 ).step( 1 ); - // sculptFolder.add( params, 'maxSteps' ).min( 1 ).max( 50 ).step( 1 ); + sculptFolder.add( params, 'maxSteps' ).min( 1 ).max( 50 ).step( 1 ); sculptFolder.add( params, 'invert' ); sculptFolder.add( params, 'flatShading' ).onChange( value => { @@ -356,17 +358,37 @@ function performStroke( point, brushOnly = false ) { const indexAttr = targetMesh.geometry.index; const posAttr = targetMesh.geometry.attributes.position; const normalAttr = targetMesh.geometry.attributes.normal; - tempVec2.copy( point ).applyMatrix4( inverseMatrix ); + const localPoint = new THREE.Vector3(); + localPoint.copy( point ).applyMatrix4( inverseMatrix ); + + const planePoint = new THREE.Vector3(); + let totalPoints = 0; indices.forEach( i => { const index = indexAttr.getX( i ); tempVec.fromBufferAttribute( normalAttr, index ); normal.add( tempVec ); + // compute the average point for cases where we need to flatten + // to the plane. + if ( ! brushOnly ) { + + totalPoints ++; + tempVec.fromBufferAttribute( posAttr, index ); + planePoint.add( tempVec ); + + } + } ); normal.normalize(); brush.quaternion.setFromUnitVectors( normalZ, normal ); + if ( totalPoints ) { + + planePoint.multiplyScalar( 1 / totalPoints ); + + } + // Early out if we just want to adjust the brush if ( brushOnly ) { @@ -377,7 +399,7 @@ function performStroke( point, brushOnly = false ) { // perform vertex adjustment const targetHeight = params.intensity * 0.000025; const plane = new THREE.Plane(); - plane.setFromNormalAndCoplanarPoint( normal, point ); + plane.setFromNormalAndCoplanarPoint( normal, planePoint ); const indexToTriangles = {}; indices.forEach( i => { @@ -386,31 +408,29 @@ function performStroke( point, brushOnly = false ) { tempVec.fromBufferAttribute( posAttr, index ); // compute the offset intensity - const dist = tempVec.distanceTo( tempVec2 ); + const dist = tempVec.distanceTo( localPoint ); + const negated = params.invert ? - 1 : 1; let intensity = 1.0 - ( dist / params.size ); - intensity = Math.pow( intensity, 3 ); - - if ( params.invert ) { - - intensity *= - 1; - - } // offset the vertex if ( params.brush === 'clay' ) { + intensity = Math.pow( intensity, 3 ); const planeDist = plane.distanceToPoint( tempVec ); - const clampedIntensity = Math.min( intensity * 5, 1 ); - tempVec.addScaledVector( normal, clampedIntensity * targetHeight - planeDist * clampedIntensity * 0.5 ); + const clampedIntensity = negated * Math.min( intensity * 5, 1 ); + tempVec.addScaledVector( normal, clampedIntensity * targetHeight - planeDist * clampedIntensity * 0.15 ); } else if ( params.brush === 'normal' ) { - tempVec.addScaledVector( normal, intensity * targetHeight ); + intensity = Math.pow( intensity, 3 ); + tempVec.addScaledVector( normal, negated * intensity * targetHeight ); } else if ( params.brush === 'flatten' ) { + intensity = Math.pow( intensity, 2 ); + const planeDist = plane.distanceToPoint( tempVec ); - tempVec.addScaledVector( normal, - planeDist * intensity * params.intensity * 0.01 ); + tempVec.addScaledVector( normal, negated * - planeDist * intensity * params.intensity * 0.01 * 0.5 ); } @@ -461,7 +481,8 @@ function performStroke( point, brushOnly = false ) { posAttr.needsUpdate = true; normalAttr.needsUpdate = true; - // TODO: refit bounds here once it's optimized + // TODO: refit bounds here once it's optimized so we don't miss raycasts + // due to out of date bounds } From 317c146d7b2fdba0a6f73ba7174d0c8cd9ab18f3 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sat, 6 Mar 2021 16:40:29 -0800 Subject: [PATCH 072/139] Add symmetry option --- example/sculpt.js | 59 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 3788ada69..56b13895e 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -20,7 +20,7 @@ THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; let stats; let scene, camera, renderer, controls; -let targetMesh, brush, bvhHelper; +let targetMesh, brush, symmetryBrush, bvhHelper; let normalZ = new THREE.Vector3( 0, 0, 1 ); let mouse = new THREE.Vector2(), lastMouse = new THREE.Vector2(); let mouseState = false, lastMouseState = false; @@ -33,6 +33,7 @@ const params = { intensity: 50, maxSteps: 20, invert: false, + symmetrical: true, flatShading: false, depth: 10, @@ -142,9 +143,12 @@ function init() { brush.material.color.set( 0xfb8c00 ); scene.add( brush ); + symmetryBrush = brush.clone(); + scene.add( symmetryBrush ); + // camera setup camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 ); - camera.position.set( 3, 3, 3 ); + camera.position.set( 0, 0, 3 ); camera.far = 100; camera.updateProjectionMatrix(); @@ -162,6 +166,7 @@ function init() { sculptFolder.add( params, 'size' ).min( 0.025 ).max( 0.25 ).step( 0.005 ); sculptFolder.add( params, 'intensity' ).min( 1 ).max( 100 ).step( 1 ); sculptFolder.add( params, 'maxSteps' ).min( 1 ).max( 50 ).step( 1 ); + sculptFolder.add( params, 'symmetrical' ); sculptFolder.add( params, 'invert' ); sculptFolder.add( params, 'flatShading' ).onChange( value => { @@ -256,7 +261,7 @@ function init() { } - params.size += delta * 0.0005; + params.size += delta * 0.0001; params.size = Math.max( Math.min( params.size, 0.25 ), 0.025 ); gui.updateDisplay(); @@ -266,7 +271,7 @@ function init() { } // Run the perform the brush movement -function performStroke( point, brushOnly = false ) { +function performStroke( point, brushObject, brushOnly = false ) { const inverseMatrix = new THREE.Matrix4(); inverseMatrix.copy( targetMesh.matrixWorld ).invert(); @@ -381,7 +386,7 @@ function performStroke( point, brushOnly = false ) { } ); normal.normalize(); - brush.quaternion.setFromUnitVectors( normalZ, normal ); + brushObject.quaternion.setFromUnitVectors( normalZ, normal ); if ( totalPoints ) { @@ -417,8 +422,8 @@ function performStroke( point, brushOnly = false ) { intensity = Math.pow( intensity, 3 ); const planeDist = plane.distanceToPoint( tempVec ); - const clampedIntensity = negated * Math.min( intensity * 5, 1 ); - tempVec.addScaledVector( normal, clampedIntensity * targetHeight - planeDist * clampedIntensity * 0.15 ); + const clampedIntensity = negated * Math.min( intensity * 2, 0.5 ) * 2.0; + tempVec.addScaledVector( normal, clampedIntensity * targetHeight - negated * planeDist * clampedIntensity * 0.1 ); } else if ( params.brush === 'normal' ) { @@ -430,7 +435,7 @@ function performStroke( point, brushOnly = false ) { intensity = Math.pow( intensity, 2 ); const planeDist = plane.distanceToPoint( tempVec ); - tempVec.addScaledVector( normal, negated * - planeDist * intensity * params.intensity * 0.01 * 0.5 ); + tempVec.addScaledVector( normal, - planeDist * intensity * params.intensity * 0.01 * 0.5 ); } @@ -513,7 +518,12 @@ function render() { brush.visible = true; brush.scale.set( params.size, params.size, 0.1 ); brush.position.copy( hit.point ); - brush.quaternion.setFromUnitVectors( normalZ, hit.face.normal ); + + symmetryBrush.visible = params.symmetrical; + symmetryBrush.scale.set( params.size, params.size, 0.1 ); + symmetryBrush.position.copy( hit.point ); + symmetryBrush.position.x *= - 1; + controls.enabled = false; // if the last cast pose was missed in the last frame then set it to @@ -527,7 +537,15 @@ function render() { // If the mouse isn't pressed don't perform the stroke if ( ! ( mouseState || lastMouseState ) ) { - performStroke( hit.point, true ); + performStroke( hit.point, brush, true ); + if ( params.symmetrical ) { + + hit.point.x *= - 1; + performStroke( hit.point, symmetryBrush, true ); + hit.point.x *= - 1; + + } + lastMouse.copy( mouse ); lastCastPose.copy( hit.point ); @@ -554,7 +572,16 @@ function render() { castDist -= step; mdist -= mstep; - performStroke( lastCastPose, false ); + performStroke( lastCastPose, brush, false ); + + if ( params.symmetrical ) { + + lastCastPose.x *= - 1; + performStroke( lastCastPose, symmetryBrush, false ); + lastCastPose.x *= - 1; + + } + stepCount ++; if ( stepCount > params.maxSteps ) { @@ -572,7 +599,14 @@ function render() { } else { - performStroke( hit.point, true ); + performStroke( hit.point, brush, true ); + if ( params.symmetrical ) { + + hit.point.x *= - 1; + performStroke( hit.point, symmetryBrush, true ); + hit.point.x *= - 1; + + } } @@ -583,6 +617,7 @@ function render() { // if we didn't hit controls.enabled = true; brush.visible = false; + symmetryBrush.visible = false; lastMouse.copy( mouse ); lastCastPose.setScalar( Infinity ); From 80f0989209bc5dbad022798ed7d81e1dd33ece47 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sat, 6 Mar 2021 16:42:54 -0800 Subject: [PATCH 073/139] Update build --- example/bundle/asyncGenerate.4a48c6e8.js | 12 +- example/bundle/characterMovement.725f956b.js | 12 +- example/bundle/collectTriangles.9c45819a.js | 12 +- example/bundle/distancecast.4107d8f2.js | 12 +- .../bundle/generateAsync.worker.13d14241.js | 10 +- example/bundle/physics.50b811f1.js | 12 +- example/bundle/randomSampleDebug.32ad2b43.js | 12 +- example/bundle/raycast.88074831.js | 12 +- example/bundle/sculpt.493e9c78.js | 51506 +--------------- example/bundle/sculpt.html | 39 +- example/bundle/selection.383a520f.js | 12 +- example/bundle/shapecast.b93a7fe2.js | 12 +- umd/index.js | 1225 +- umd/index.js.map | 2 +- 14 files changed, 989 insertions(+), 51901 deletions(-) diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index 25f738d46..4a6fccf76 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -12,7 +12,7 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -28,15 +28,13 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var i=this.worker;return this.running=!0,new Promise(function(o,a){i.onmessage=function(t){n.running=!1,i.onmessage=null;var s=t.data,u=s.serialized,f=s.position,l=s.error;if(l)a(new Error(l));else{var d=e.default.deserialize(u,r,!1);r.attributes.position.array=f,r.index&&(r.index.array=u.index),o(d)}};var s=r.index?r.index.array:null,u=r.attributes.position.array;if(u.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var f=[u];s&&f.push(s),i.postMessage({index:s,position:u,options:t},f.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),r}();exports.GenerateMeshBVHWorker=o; },{"../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -36,13 +36,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -555,13 +555,11 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -561,12 +561,10 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return rn&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -23,12 +23,10 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return rn&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -34,13 +34,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -23,13 +23,11 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -556,12 +556,10 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles -parcelRequire = (function (modules, cache, entry, globalName) { - // Save the require from previous bundle to this closure if any - var previousRequire = typeof parcelRequire === 'function' && parcelRequire; - var nodeRequire = typeof require === 'function' && require; - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = typeof parcelRequire === 'function' && parcelRequire; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error('Cannot find module \'' + name + '\''); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = cache[name] = new newRequire.Module(name); - - modules[name][0].call(module.exports, localRequire, module, module.exports, this); - } - - return cache[name].exports; - - function localRequire(x){ - return newRequire(localRequire.resolve(x)); - } - - function resolve(x){ - return modules[name][1][x] || x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.register = function (id, exports) { - modules[id] = [function (require, module) { - module.exports = exports; - }, {}]; - }; - - var error; - for (var i = 0; i < entry.length; i++) { - try { - newRequire(entry[i]); - } catch (e) { - // Save first error but execute all entries - if (!error) { - error = e; - } - } - } - - if (entry.length) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(entry[entry.length - 1]); - - // CommonJS - if (typeof exports === "object" && typeof module !== "undefined") { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === "function" && define.amd) { - define(function () { - return mainExports; - }); - - // - - +THREE.js BVH Geometry Sculpting
Inspired by and Matcap texture from SculptGL.
\ No newline at end of file diff --git a/example/bundle/selection.383a520f.js b/example/bundle/selection.383a520f.js index 62d515583..258a79102 100644 --- a/example/bundle/selection.383a520f.js +++ b/example/bundle/selection.383a520f.js @@ -14,7 +14,7 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -30,13 +30,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -560,12 +560,10 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r Math.pow( 2, 32 ) ) { + + throw new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' ); + + } + + uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; + nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); + + uint32Array[ stride4Offset + 7 ] = splitAxis; + return nextUnusedPointer; + + } + + } + + } + class SeparatingAxisBounds { constructor() { @@ -1948,42 +2010,37 @@ } + /* Generated from "castFunctions.template.js". Do not edit. */ + const boundingBox = new three.Box3(); const boxIntersection = new three.Vector3(); const xyzFields$1 = [ 'x', 'y', 'z' ]; - function intersectRay( node, ray, target ) { - - arrayToBox( node.boundingData, boundingBox ); - - return ray.intersectBox( boundingBox, target ); - - } - - function raycast( node, mesh, raycaster, ray, intersects ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); + function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { - } + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! ! node.count; + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - intersectTris( mesh, mesh.geometry, raycaster, ray, node.offset, node.count, intersects ); + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + + intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); } else { - if ( intersectRay( node.left, ray, boxIntersection ) ) { + const leftIndex = nodeIndex32 + 8; + if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { - raycast( node.left, mesh, raycaster, ray, intersects ); + raycast( leftIndex, mesh, raycaster, ray, intersects ); } - if ( intersectRay( node.right, ray, boxIntersection ) ) { + const rightIndex = uint32Array[ nodeIndex32 + 6 ]; + if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { - raycast( node.right, mesh, raycaster, ray, intersects ); + raycast( rightIndex, mesh, raycaster, ray, intersects ); } @@ -1991,25 +2048,22 @@ } - function raycastFirst( node, mesh, raycaster, ray ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); + function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { - } + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! ! node.count; + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, node.offset, node.count ); + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); } else { - // consider the position of the split plane with respect to the oncoming ray; whichever direction // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = node.splitAxis; + const splitAxis = uint32Array[ nodeIndex32 + 7 ]; const xyzAxis = xyzFields$1[ splitAxis ]; const rayDir = ray.direction[ xyzAxis ]; const leftToRight = rayDir >= 0; @@ -2018,17 +2072,17 @@ let c1, c2; if ( leftToRight ) { - c1 = node.left; - c2 = node.right; + c1 = nodeIndex32 + 8; + c2 = uint32Array[ nodeIndex32 + 6 ]; } else { - c1 = node.right; - c2 = node.left; + c1 = uint32Array[ nodeIndex32 + 6 ]; + c2 = nodeIndex32 + 8; } - const c1Intersection = intersectRay( c1, ray, boxIntersection ); + const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; // if we got an intersection in the first node and it's closer than the second node's bounding @@ -2038,8 +2092,8 @@ // check if the point is within the second bounds const point = c1Result.point[ xyzAxis ]; const isOutside = leftToRight ? - point <= c2.boundingData[ splitAxis ] : - point >= c2.boundingData[ splitAxis + 3 ]; + point <= float32Array[ c2 + splitAxis ] : // min bounding data + point >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data if ( isOutside ) { @@ -2051,7 +2105,7 @@ // either there was no intersection in the first node, or there could still be a closer // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRay( c2, ray, boxIntersection ); + const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; if ( c1Result && c2Result ) { @@ -2103,8 +2157,7 @@ } - return function shapecast( - node, + return function shapecast( nodeIndex32, mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, @@ -2117,70 +2170,54 @@ // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents - function getLeftOffset( node ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); + function getLeftOffset( nodeIndex32 ) { - } - - while ( ! node.count ) { + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; - node = node.left; - if ( /* skip */ node.continueGeneration ) { + // traverse until we find a leaf + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { - node.continueGeneration(); - - } + nodeIndex32 = nodeIndex32 + 8; + nodeIndex16 = nodeIndex32 * 2; } - return node.offset; + return uint32Array[ nodeIndex32 + 6 ]; } - function getRightEndOffset( node ) { + function getRightEndOffset( nodeIndex32 ) { - if ( node.continueGeneration ) { + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; - node.continueGeneration(); + // traverse until we find a leaf + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { - } - - while ( ! node.count ) { - - node = node.right; - if ( /* skip */ node.continueGeneration ) { - - node.continueGeneration(); - - } + // adjust offset to point to the right node + nodeIndex32 = uint32Array[ nodeIndex32 + 6 ]; + nodeIndex16 = nodeIndex32 * 2; } - return node.offset + node.count; + // return the end offset of the triangle range + return uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ]; } - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! ! node.count; + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf && intersectsTriangleFunc ) { const geometry = mesh.geometry; - const offset = node.offset; - const count = node.count; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); } else { - const left = node.left; - const right = node.right; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; let c1 = left; let c2 = right; @@ -2191,8 +2228,9 @@ box1 = cachedBox1; box2 = cachedBox2; - arrayToBox( c1.boundingData, box1 ); - arrayToBox( c2.boundingData, box2 ); + // bounding data is not offset + arrayToBox$1( c1, float32Array, box1 ); + arrayToBox$1( c2, float32Array, box2 ); score1 = nodeScoreFunc( box1 ); score2 = nodeScoreFunc( box2 ); @@ -2217,11 +2255,11 @@ if ( ! box1 ) { box1 = cachedBox1; - arrayToBox( c1.boundingData, box1 ); + arrayToBox$1( c1, float32Array, box1 ); } - const isC1Leaf = ! ! c1.count; + const isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF ); const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); let c1StopTraversal; @@ -2257,9 +2295,9 @@ // Check box 2 intersection // cached box2 will have been overwritten by previous traversal box2 = cachedBox2; - arrayToBox( c2.boundingData, box2 ); + arrayToBox$1( c2, float32Array, box2 ); - const isC2Leaf = ! ! c2.count; + const isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF ); const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); let c2StopTraversal; @@ -2310,13 +2348,9 @@ const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); + return function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { - } + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; if ( cachedObb === null ) { @@ -2332,7 +2366,7 @@ } - const isLeaf = ! ! node.count; + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { const thisGeometry = mesh.geometry; @@ -2342,8 +2376,8 @@ const index = geometry.index; const pos = geometry.attributes.position; - const offset = node.offset; - const count = node.count; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; // get the inverse of the geometry matrix so we can transform our triangles into the // geometry space we're trying to test. We assume there are fewer triangles being checked @@ -2352,7 +2386,7 @@ if ( geometry.boundsTree ) { - arrayToBox( node.boundingData, obb2 ); + arrayToBox$1( nodeIndex32, float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); @@ -2414,18 +2448,17 @@ } else { - const left = node.left; - const right = node.right; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; - arrayToBox( left.boundingData, boundingBox ); + arrayToBox$1( left, float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; - - arrayToBox( right.boundingData, boundingBox ); + arrayToBox$1( right, float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); @@ -2440,710 +2473,254 @@ } )(); - const boundingBox$1 = new three.Box3(); - const boxIntersection$1 = new three.Vector3(); - const xyzFields$2 = [ 'x', 'y', 'z' ]; + function intersectRay( nodeIndex32, array, ray, target ) { + + arrayToBox$1( nodeIndex32, array, boundingBox ); + return ray.intersectBox( boundingBox, target ); - function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { + } - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + const bufferStack = []; + let _prevBuffer; + let _float32Array; + let _uint16Array; + let _uint32Array; + function setBuffer( buffer ) { - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf ) { + if ( _prevBuffer ) { - intersectTris( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ], intersects ); + bufferStack.push( _prevBuffer ); - } else { + } - if ( intersectRayBuffer( /* node left */ stride4Offset + 8, float32Array, ray, boxIntersection$1 ) ) { + _prevBuffer = buffer; + _float32Array = new Float32Array( buffer ); + _uint16Array = new Uint16Array( buffer ); + _uint32Array = new Uint32Array( buffer ); - raycastBuffer( /* node left */ stride4Offset + 8, mesh, raycaster, ray, intersects ); + } - } + function clearBuffer() { - if ( intersectRayBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], float32Array, ray, boxIntersection$1 ) ) { + _prevBuffer = null; + _float32Array = null; + _uint16Array = null; + _uint32Array = null; - raycastBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], mesh, raycaster, ray, intersects ); + if ( bufferStack.length ) { - } + setBuffer( bufferStack.pop() ); } } - function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { + function arrayToBox$1( nodeIndex32, array, target ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + target.min.x = array[ nodeIndex32 ]; + target.min.y = array[ nodeIndex32 + 1 ]; + target.min.z = array[ nodeIndex32 + 2 ]; - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf ) { + target.max.x = array[ nodeIndex32 + 3 ]; + target.max.y = array[ nodeIndex32 + 4 ]; + target.max.z = array[ nodeIndex32 + 5 ]; - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ] ); + } - } else { + const SKIP_GENERATION = Symbol( 'skip tree generation' ); - // consider the position of the split plane with respect to the oncoming ray; whichever direction - // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = /* node splitAxis */ uint32Array[ stride4Offset + 7 ]; - const xyzAxis = xyzFields$2[ splitAxis ]; - const rayDir = ray.direction[ xyzAxis ]; - const leftToRight = rayDir >= 0; + const obb = new OrientedBox(); + const temp = new three.Vector3(); + const tri2 = new SeparatingAxisTriangle(); + const temp1 = new three.Vector3(); + const temp2 = new three.Vector3(); - // c1 is the child to check first - let c1, c2; - if ( leftToRight ) { + class MeshBVH { - c1 = /* node left */ stride4Offset + 8; - c2 = /* node right */ uint32Array[ stride4Offset + 6 ]; + static serialize( bvh, geometry, copyIndexBuffer = true ) { - } else { + const rootData = bvh._roots; + const indexAttribute = geometry.getIndex(); + const result = { + roots: rootData, + index: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array, + }; - c1 = /* node right */ uint32Array[ stride4Offset + 6 ]; - c2 = /* node left */ stride4Offset + 8; + return result; - } + } - const c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection$1 ); - const c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null; + static deserialize( data, geometry, setIndex = true ) { - // if we got an intersection in the first node and it's closer than the second node's bounding - // box, we don't need to consider the second node because it couldn't possibly be a better result - if ( c1Result ) { + const { index, roots } = data; + const bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } ); + bvh._roots = roots; - // check if the point is within the second bounds - const point = c1Result.point[ xyzAxis ]; - const isOutside = leftToRight ? - point <= /* c2 boundingData */ float32Array[ c2 + splitAxis ] : - point >= /* c2 boundingData */ float32Array[ c2 + splitAxis + 3 ]; + if ( setIndex ) { - if ( isOutside ) { + const indexAttribute = geometry.getIndex(); + if ( indexAttribute === null ) { - return c1Result; + const newIndex = new three.BufferAttribute( data.index, 1, false ); + geometry.setIndex( newIndex ); + + } else if ( indexAttribute.array !== index ) { + + indexAttribute.array.set( index ); + indexAttribute.needsUpdate = true; } } - // either there was no intersection in the first node, or there could still be a closer - // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection$1 ); - const c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null; + return bvh; - if ( c1Result && c2Result ) { + } - return c1Result.distance <= c2Result.distance ? c1Result : c2Result; + constructor( geo, options = {} ) { - } else { + if ( ! geo.isBufferGeometry ) { - return c1Result || c2Result || null; + throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); - } + } else if ( geo.attributes.position.isInterleavedBufferAttribute ) { - } + throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); - } + } else if ( geo.index && geo.index.isInterleavedBufferAttribute ) { - const shapecastBuffer = ( function () { + throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); - const _triangle = new SeparatingAxisTriangle(); - const _cachedBox1 = new three.Box3(); - const _cachedBox2 = new three.Box3(); + } - function iterateOverTriangles( - offset, - count, - geometry, - intersectsTriangleFunc, - contained, - depth, - triangle - ) { + // default options + options = Object.assign( { - const index = geometry.index; - const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + strategy: CENTER, + maxDepth: 40, + maxLeafTris: 10, + verbose: true, - setTriangle( triangle, i, index, pos ); - triangle.needsUpdate = true; + // undocumented options - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { + // Whether to skip generating the tree. Used for deserialization. + [ SKIP_GENERATION ]: false - return true; + }, options ); + options.strategy = Math.max( 0, Math.min( 2, options.strategy ) ); - } + this._roots = null; + if ( ! options[ SKIP_GENERATION ] ) { - } + this._roots = buildPackedTree( geo, options ); - return false; + } } - return function shapecastBuffer( stride4Offset, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc = null, - nodeScoreFunc = null, - depth = 0, - triangle = _triangle, - cachedBox1 = _cachedBox1, - cachedBox2 = _cachedBox2 - ) { + refit( geometry ) { - // Define these inside the function so it has access to the local variables needed - // when converting to the buffer equivalents - function getLeftOffsetBuffer( stride4Offset ) { + const indexArr = geometry.index.array; + const posArr = geometry.attributes.position.array; + let buffer, uint32Array, uint16Array, float32Array; + const roots = this._roots; + for ( let i = 0, l = roots.length; i < l; i ++ ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + buffer = roots[ i ]; + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + float32Array = new Float32Array( buffer ); + _traverse( 0 ); - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { + } - /* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2; + function _traverse( node32Index ) { - } - - return /* node offset */ uint32Array[ stride4Offset + 6 ]; - - } - - function getRightEndOffsetBuffer( stride4Offset ) { - - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { - - /* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2; - - } - - return /* node offset */ uint32Array[ stride4Offset + 6 ] + /* node count */ uint16Array[ stride2Offset + 14 ]; - - } - - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf && intersectsTriangleFunc ) { - - const geometry = mesh.geometry; - const offset = /* node offset */ uint32Array[ stride4Offset + 6 ]; - const count = /* node count */ uint16Array[ stride2Offset + 14 ]; - return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); - - } else { - - const left = /* node left */ stride4Offset + 8; - const right = /* node right */ uint32Array[ stride4Offset + 6 ]; - let c1 = left; - let c2 = right; - - let score1, score2; - let box1, box2; - if ( nodeScoreFunc ) { - - box1 = cachedBox1; - box2 = cachedBox2; + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; + if ( isLeaf ) { - arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); - arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; - score1 = nodeScoreFunc( box1 ); - score2 = nodeScoreFunc( box2 ); + let minx = Infinity; + let miny = Infinity; + let minz = Infinity; + let maxx = - Infinity; + let maxy = - Infinity; + let maxz = - Infinity; + for ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) { - if ( score2 < score1 ) { + const index3 = indexArr[ i ] * 3; + const x = posArr[ index3 + 0 ]; + const y = posArr[ index3 + 1 ]; + const z = posArr[ index3 + 2 ]; - c1 = right; - c2 = left; + if ( x < minx ) minx = x; + if ( x > maxx ) maxx = x; - const temp = score1; - score1 = score2; - score2 = temp; + if ( y < miny ) miny = y; + if ( y > maxy ) maxy = y; - box1 = box2; - // box2 is always set before use below + if ( z < minz ) minz = z; + if ( z > maxz ) maxz = z; } - } - - // Check box 1 intersection - if ( ! box1 ) { - - box1 = cachedBox1; - arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); - - } - - const isC1Leaf = ! /* c1 count */ ( uint16Array[ c1 + 15 ] !== 0xffff ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); - - let c1StopTraversal; - if ( c1Intersection === CONTAINED ) { - - const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c1 ); - const end = getRightEndOffsetBuffer( c1 ); - const count = end - offset; - - c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + if ( + float32Array[ node32Index + 0 ] !== minx || + float32Array[ node32Index + 1 ] !== miny || + float32Array[ node32Index + 2 ] !== minz || - } else { + float32Array[ node32Index + 3 ] !== maxx || + float32Array[ node32Index + 4 ] !== maxy || + float32Array[ node32Index + 5 ] !== maxz + ) { - c1StopTraversal = - c1Intersection && - shapecastBuffer( - c1, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc, - nodeScoreFunc, - depth + 1, - triangle, - cachedBox1, - cachedBox2 - ); + float32Array[ node32Index + 0 ] = minx; + float32Array[ node32Index + 1 ] = miny; + float32Array[ node32Index + 2 ] = minz; - } - - if ( c1StopTraversal ) return true; - - // Check box 2 intersection - // cached box2 will have been overwritten by previous traversal - box2 = cachedBox2; - arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); - - const isC2Leaf = ! /* c2 count */ ( uint16Array[ c2 + 15 ] !== 0xffff ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); - - let c2StopTraversal; - if ( c2Intersection === CONTAINED ) { - - const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c2 ); - const end = getRightEndOffsetBuffer( c2 ); - const count = end - offset; - - c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); - - } else { - - c2StopTraversal = - c2Intersection && - shapecastBuffer( - c2, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc, - nodeScoreFunc, - depth + 1, - triangle, - cachedBox1, - cachedBox2 - ); - - } - - if ( c2StopTraversal ) return true; - - return false; - - } - - }; + float32Array[ node32Index + 3 ] = maxx; + float32Array[ node32Index + 4 ] = maxy; + float32Array[ node32Index + 5 ] = maxz; - } )(); - - const intersectsGeometryBuffer = ( function () { - - const triangle = new SeparatingAxisTriangle(); - const triangle2 = new SeparatingAxisTriangle(); - const cachedMesh = new three.Mesh(); - const invertedMat = new three.Matrix4(); - - const obb = new OrientedBox(); - const obb2 = new OrientedBox(); - - return function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) { - - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - - if ( cachedObb === null ) { - - if ( ! geometry.boundingBox ) { - - geometry.computeBoundingBox(); - - } - - obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); - obb.update(); - cachedObb = obb; - - } - - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf ) { - - const thisGeometry = mesh.geometry; - const thisIndex = thisGeometry.index; - const thisPos = thisGeometry.attributes.position; - - const index = geometry.index; - const pos = geometry.attributes.position; - - const offset = /* node offset */ uint32Array[ stride4Offset + 6 ]; - const count = /* node count */ uint16Array[ stride2Offset + 14 ]; - - // get the inverse of the geometry matrix so we can transform our triangles into the - // geometry space we're trying to test. We assume there are fewer triangles being checked - // here. - invertedMat.copy( geometryToBvh ).invert(); - - if ( geometry.boundsTree ) { - - arrayToBoxBuffer( /* node boundingData */ stride4Offset, float32Array, obb2 ); - obb2.matrix.copy( invertedMat ); - obb2.update(); - - cachedMesh.geometry = geometry; - const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { - - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); - - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { - - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { - - return true; - - } + return true; - } + } else { return false; - } ); - cachedMesh.geometry = null; - - return res; + } } else { - for ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) { - - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle, i, thisIndex, thisPos ); - triangle.a.applyMatrix4( invertedMat ); - triangle.b.applyMatrix4( invertedMat ); - triangle.c.applyMatrix4( invertedMat ); - triangle.update(); + const left = node32Index + 8; + const right = uint32Array[ node32Index + 6 ]; - for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + const leftChange = _traverse( left ); + const rightChange = _traverse( right ); + const didChange = leftChange || rightChange; - setTriangle( triangle2, i2, index, pos ); - triangle2.update(); + if ( didChange ) { - if ( triangle.intersectsTriangle( triangle2 ) ) { + for ( let i = 0; i < 3; i ++ ) { - return true; + const lefti = left + i; + const righti = right + i; + const minLeftValue = float32Array[ lefti ]; + const maxLeftValue = float32Array[ lefti + 3 ]; + const minRightValue = float32Array[ righti ]; + const maxRightValue = float32Array[ righti + 3 ]; - } + float32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue; + float32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue; } } - } - - } else { - - const left = /* node left */ stride4Offset + 8; - const right = /* node right */ uint32Array[ stride4Offset + 6 ]; - - arrayToBoxBuffer( /* left boundingData */ left, float32Array, boundingBox$1 ); - const leftIntersection = - cachedObb.intersectsBox( boundingBox$1 ) && - intersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb ); - - if ( leftIntersection ) return true; - - arrayToBoxBuffer( /* right boundingData */ right, float32Array, boundingBox$1 ); - const rightIntersection = - cachedObb.intersectsBox( boundingBox$1 ) && - intersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb ); - - if ( rightIntersection ) return true; - - return false; - - } - - }; - - } )(); - - function intersectRayBuffer( stride4Offset, array, ray, target ) { - - arrayToBoxBuffer( stride4Offset, array, boundingBox$1 ); - return ray.intersectBox( boundingBox$1, target ); - - } - - const bufferStack = []; - let _prevBuffer; - let _float32Array; - let _uint16Array; - let _uint32Array; - function setBuffer( buffer ) { - - if ( _prevBuffer ) { - - bufferStack.push( _prevBuffer ); - - } - - _prevBuffer = buffer; - _float32Array = new Float32Array( buffer ); - _uint16Array = new Uint16Array( buffer ); - _uint32Array = new Uint32Array( buffer ); - - } - - function clearBuffer() { - - _prevBuffer = null; - _float32Array = null; - _uint16Array = null; - _uint32Array = null; - - if ( bufferStack.length ) { - - setBuffer( bufferStack.pop() ); - - } - - } - - function arrayToBoxBuffer( stride4Offset, array, target ) { - - target.min.x = array[ stride4Offset ]; - target.min.y = array[ stride4Offset + 1 ]; - target.min.z = array[ stride4Offset + 2 ]; - - target.max.x = array[ stride4Offset + 3 ]; - target.max.y = array[ stride4Offset + 4 ]; - target.max.z = array[ stride4Offset + 5 ]; - - } - - // boundingData : 6 float32 - // right / offset : 1 uint32 - // splitAxis / isLeaf + count : 1 uint32 / 2 uint16 - const BYTES_PER_NODE = 6 * 4 + 4 + 4; - const IS_LEAFNODE_FLAG = 0xFFFF; - const SKIP_GENERATION = Symbol( 'skip tree generation' ); - - const obb = new OrientedBox(); - const temp = new three.Vector3(); - const tri2 = new SeparatingAxisTriangle(); - const temp1 = new three.Vector3(); - const temp2 = new three.Vector3(); - - class MeshBVH { - - static serialize( bvh, geometry, copyIndexBuffer = true ) { - - function finishTree( node ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - - if ( ! node.count ) { - - finishTree( node.left ); - finishTree( node.right ); - - } - - } - - function countNodes( node ) { - - if ( node.count ) { - - return 1; - - } else { - - return 1 + countNodes( node.left ) + countNodes( node.right ); - - } - - } - - function populateBuffer( byteOffset, node ) { - - const stride4Offset = byteOffset / 4; - const stride2Offset = byteOffset / 2; - const isLeaf = ! ! node.count; - const boundingData = node.boundingData; - for ( let i = 0; i < 6; i ++ ) { - - float32Array[ stride4Offset + i ] = boundingData[ i ]; - - } - - if ( isLeaf ) { - - const offset = node.offset; - const count = node.count; - uint32Array[ stride4Offset + 6 ] = offset; - uint16Array[ stride2Offset + 14 ] = count; - uint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG; - return byteOffset + BYTES_PER_NODE; - - } else { - - const left = node.left; - const right = node.right; - const splitAxis = node.splitAxis; - - let nextUnusedPointer; - nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); - - uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; - nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); - - uint32Array[ stride4Offset + 7 ] = splitAxis; - return nextUnusedPointer; - - } - - } - - let float32Array; - let uint32Array; - let uint16Array; - - const roots = bvh._roots; - let rootData; - - if ( bvh._isPacked ) { - - rootData = roots; - - } else { - - rootData = []; - for ( let i = 0; i < roots.length; i ++ ) { - - const root = roots[ i ]; - finishTree( root ); - let nodeCount = countNodes( root ); - - const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); - float32Array = new Float32Array( buffer ); - uint32Array = new Uint32Array( buffer ); - uint16Array = new Uint16Array( buffer ); - populateBuffer( 0, root ); - rootData.push( buffer ); - - } - - } - - const indexAttribute = geometry.getIndex(); - const result = { - roots: rootData, - index: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array, - }; - - return result; - - } - - static deserialize( data, geometry, setIndex = true ) { - - const { index, roots } = data; - const bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } ); - bvh._roots = roots; - bvh._isPacked = true; - - if ( setIndex ) { - - const indexAttribute = geometry.getIndex(); - if ( indexAttribute === null ) { - - const newIndex = new three.BufferAttribute( data.index, 1, false ); - geometry.setIndex( newIndex ); - - } else if ( indexAttribute.array !== index ) { - - indexAttribute.array.set( index ); - indexAttribute.needsUpdate = true; - - } - - } - - return bvh; - - } - - constructor( geo, options = {} ) { - - if ( ! geo.isBufferGeometry ) { - - throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); - - } else if ( geo.attributes.position.isInterleavedBufferAttribute ) { - - throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); - - } else if ( geo.index && geo.index.isInterleavedBufferAttribute ) { - - throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); - - } - - // default options - options = Object.assign( { - - strategy: CENTER, - maxDepth: 40, - maxLeafTris: 10, - verbose: true, - lazyGeneration: true, - - // undocumented options - - // whether to the pack the data as a buffer or not. The data - // will not be packed if lazyGeneration is true. - packData: true, - - // Whether to skip generating the tree. Used for deserialization. - [ SKIP_GENERATION ]: false - - }, options ); - options.strategy = Math.max( 0, Math.min( 2, options.strategy ) ); - - this._isPacked = false; - this._roots = null; - if ( ! options[ SKIP_GENERATION ] ) { - - this._roots = buildTree( geo, options ); - if ( ! options.lazyGeneration && options.packData ) { - - this._roots = MeshBVH.serialize( this, geo, false ).roots; - this._isPacked = true; + return didChange; } @@ -3153,62 +2730,32 @@ traverse( callback, rootIndex = 0 ) { - if ( this._isPacked ) { - - const buffer = this._roots[ rootIndex ]; - const uint32Array = new Uint32Array( buffer ); - const uint16Array = new Uint16Array( buffer ); - _traverseBuffer( 0 ); - - function _traverseBuffer( stride4Offset, depth = 0 ) { - - const stride2Offset = stride4Offset * 2; - const isLeaf = uint16Array[ stride2Offset + 15 ]; - if ( isLeaf ) { - - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; - callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count ); - - } else { - - const left = stride4Offset + BYTES_PER_NODE / 4; - const right = uint32Array[ stride4Offset + 6 ]; - const splitAxis = uint32Array[ stride4Offset + 7 ]; - const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis, false ); - - if ( ! stopTraversal ) { - - _traverseBuffer( left, depth + 1 ); - _traverseBuffer( right, depth + 1 ); - - } - - } - - } - - } else { + const buffer = this._roots[ rootIndex ]; + const uint32Array = new Uint32Array( buffer ); + const uint16Array = new Uint16Array( buffer ); + _traverse( 0 ); - _traverseNode( this._roots[ rootIndex ] ); + function _traverse( node32Index, depth = 0 ) { - function _traverseNode( node, depth = 0 ) { - - const isLeaf = ! ! node.count; - if ( isLeaf ) { - - callback( depth, isLeaf, node.boundingData, node.offset, node.count ); + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; + if ( isLeaf ) { - } else { + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; + callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count ); - const stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis, ! ! node.continueGeneration ); + } else { - if ( ! stopTraversal ) { + const left = node32Index + BYTES_PER_NODE / 4; + const right = uint32Array[ node32Index + 6 ]; + const splitAxis = uint32Array[ node32Index + 7 ]; + const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis ); - if ( node.left ) _traverseNode( node.left, depth + 1 ); - if ( node.right ) _traverseNode( node.right, depth + 1 ); + if ( ! stopTraversal ) { - } + _traverse( left, depth + 1 ); + _traverse( right, depth + 1 ); } @@ -3221,43 +2768,24 @@ /* Core Cast Functions */ raycast( mesh, raycaster, ray, intersects ) { - const isPacked = this._isPacked; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - raycastBuffer( 0, mesh, raycaster, ray, intersects ); - - } else { - - raycast( root, mesh, raycaster, ray, intersects ); - - } + setBuffer( root ); + raycast( 0, mesh, raycaster, ray, intersects ); } - isPacked && clearBuffer(); + clearBuffer(); } raycastFirst( mesh, raycaster, ray ) { - const isPacked = this._isPacked; let closestResult = null; for ( const root of this._roots ) { - let result; - if ( isPacked ) { - - setBuffer( root ); - result = raycastFirstBuffer( 0, mesh, raycaster, ray ); - - } else { - - result = raycastFirst( root, mesh, raycaster, ray ); - - } + setBuffer( root ); + const result = raycastFirst( 0, mesh, raycaster, ray ); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -3267,7 +2795,7 @@ } - isPacked && clearBuffer(); + clearBuffer(); return closestResult; @@ -3275,20 +2803,11 @@ intersectsGeometry( mesh, geometry, geomToMesh ) { - const isPacked = this._isPacked; let result = false; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - result = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh ); - - } else { - - result = intersectsGeometry( root, mesh, geometry, geomToMesh ); - - } + setBuffer( root ); + result = intersectsGeometry( 0, mesh, geometry, geomToMesh ); if ( result ) { @@ -3298,7 +2817,7 @@ } - isPacked && clearBuffer(); + clearBuffer(); return result; @@ -3306,20 +2825,11 @@ shapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) { - const isPacked = this._isPacked; let result = false; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - result = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); - - } else { - - result = shapecast( root, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); - - } + setBuffer( root ); + result = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); if ( result ) { @@ -3329,7 +2839,7 @@ } - isPacked && clearBuffer(); + clearBuffer(); return result; @@ -3519,7 +3029,7 @@ const wiremat = new three.LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } ); const boxGeom = new three.Box3Helper().geometry; - let boundingBox$2 = new three.Box3(); + let boundingBox$1 = new three.Box3(); class MeshBVHRootVisualizer extends three.Group { @@ -3528,9 +3038,7 @@ super( 'MeshBVHRootVisualizer' ); this.depth = depth; - this._oldDepth = - 1; this.mesh = mesh; - this._boundsTree = null; this._group = group; this.update(); @@ -3539,13 +3047,11 @@ update() { - this._oldDepth = this.depth; - this._boundsTree = this.mesh.geometry.boundsTree; - + const boundsTree = this.mesh.geometry.boundsTree; let requiredChildren = 0; - if ( this._boundsTree ) { + if ( boundsTree ) { - this._boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { + boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { let isTerminal = isLeaf || countOrIsUnfinished; @@ -3568,9 +3074,9 @@ } requiredChildren ++; - arrayToBox( boundingData, boundingBox$2 ); - boundingBox$2.getCenter( m.position ); - m.scale.subVectors( boundingBox$2.max, boundingBox$2.min ).multiplyScalar( 0.5 ); + arrayToBox( boundingData, boundingBox$1 ); + boundingBox$1.getCenter( m.position ); + m.scale.subVectors( boundingBox$1.max, boundingBox$1.min ).multiplyScalar( 0.5 ); if ( m.scale.x === 0 ) m.scale.x = Number.EPSILON; if ( m.scale.y === 0 ) m.scale.y = Number.EPSILON; @@ -3624,6 +3130,7 @@ let root = this._roots[ i ]; root.depth = this.depth; + root.mesh = this.mesh; root.update(); } @@ -3695,7 +3202,7 @@ splits: [ 0, 0, 0 ] }; - bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { + bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => { result.total ++; if ( isLeaf ) { @@ -3703,8 +3210,8 @@ result.depth.min = Math.min( depth, result.depth.min ); result.depth.max = Math.max( depth, result.depth.max ); - result.tris.min = Math.min( countOrIsUnfinished, result.tris.min ); - result.tris.max = Math.max( countOrIsUnfinished, result.tris.max ); + result.tris.min = Math.min( count, result.tris.min ); + result.tris.max = Math.max( count, result.tris.max ); } else { diff --git a/umd/index.js.map b/umd/index.js.map index 9b95dffdf..479124390 100644 --- a/umd/index.js.map +++ b/umd/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/castFunctions.js","../src/castFunctionsBuffer.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tif ( lazyGeneration ) {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData );\r\n\t\t\t\tleft.continueGeneration = function () {\r\n\r\n\t\t\t\t\tdelete this.continueGeneration;\r\n\t\t\t\t\tgetCentroidBounds( triangleBounds, lstart, lcount, cacheCentroidBoundingData );\r\n\t\t\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tif ( lazyGeneration ) {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData );\r\n\t\t\t\tright.continueGeneration = function () {\r\n\r\n\t\t\t\t\tdelete this.continueGeneration;\r\n\t\t\t\t\tgetCentroidBounds( triangleBounds, rstart, rcount, cacheCentroidBoundingData );\r\n\t\t\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tconst lazyGeneration = options.lazyGeneration;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// if the geometry doesn't have a bounding box, then let's politely populate it using\r\n\t// the work we did to determine the BVH root bounds\r\n\tif ( geo.boundingBox == null ) {\r\n\r\n\t\tconst rootBox = new Box3();\r\n\t\tgeo.boundingBox = new Box3();\r\n\r\n\t\tfor ( let root of roots ) {\r\n\r\n\t\t\tgeo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nfunction intersectRay( node, ray, target ) {\r\n\r\n\tarrayToBox( node.boundingData, boundingBox );\r\n\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nexport function raycast( node, mesh, raycaster, ray, intersects ) {\r\n\r\n\tif ( node.continueGeneration ) {\r\n\r\n\t\tnode.continueGeneration();\r\n\r\n\t}\r\n\r\n\tconst isLeaf = ! ! node.count;\r\n\tif ( isLeaf ) {\r\n\r\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, node.offset, node.count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tif ( intersectRay( node.left, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( node.left, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tif ( intersectRay( node.right, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( node.right, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( node, mesh, raycaster, ray ) {\r\n\r\n\tif ( node.continueGeneration ) {\r\n\r\n\t\tnode.continueGeneration();\r\n\r\n\t}\r\n\r\n\tconst isLeaf = ! ! node.count;\r\n\tif ( isLeaf ) {\r\n\r\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, node.offset, node.count );\r\n\r\n\t} else {\r\n\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = node.splitAxis;\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = node.left;\r\n\t\t\tc2 = node.right;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = node.right;\r\n\t\t\tc2 = node.left;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= c2.boundingData[ splitAxis ] :\r\n\t\t\t\tpoint >= c2.boundingData[ splitAxis + 3 ];\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnode,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc = null,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( node ) {\r\n\r\n\t\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t}\r\n\r\n\t\t\twhile ( ! node.count ) {\r\n\r\n\t\t\t\tnode = node.left;\r\n\t\t\t\tif ( /* skip */ node.continueGeneration ) {\r\n\r\n\t\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn node.offset;\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( node ) {\r\n\r\n\t\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t}\r\n\r\n\t\t\twhile ( ! node.count ) {\r\n\r\n\t\t\t\tnode = node.right;\r\n\t\t\t\tif ( /* skip */ node.continueGeneration ) {\r\n\r\n\t\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn node.offset + node.count;\r\n\r\n\t\t}\r\n\r\n\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\tnode.continueGeneration();\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tif ( isLeaf && intersectsTriangleFunc ) {\r\n\r\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\tarrayToBox( c1.boundingData, box1 );\r\n\t\t\t\tarrayToBox( c2.boundingData, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1.boundingData, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ! ! c1.count;\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2.boundingData, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ! ! c2.count;\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\tnode.continueGeneration();\r\n\r\n\t\t}\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! geometry.boundingBox ) {\r\n\r\n\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( geometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( node.boundingData, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\r\n\t\t\tarrayToBox( left.boundingData, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\r\n\t\t\tarrayToBox( right.boundingData, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","\n/**************************************************************************************************\n *\n * This file is generated from castFunctions.js and scripts/generate-cast-function.mjs. Do not edit.\n *\n *************************************************************************************************/\n\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\n\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\n\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\n\nexport function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) {\n\n\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\tif ( isLeaf ) {\n\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ], intersects );\n\n\t} else {\n\n\t\tif ( intersectRayBuffer( /* node left */ stride4Offset + 8, float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycastBuffer( /* node left */ stride4Offset + 8, mesh, raycaster, ray, intersects );\n\n\t\t}\n\n\t\tif ( intersectRayBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycastBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], mesh, raycaster, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) {\n\n\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\tif ( isLeaf ) {\n\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ] );\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = /* node splitAxis */ uint32Array[ stride4Offset + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = /* node left */ stride4Offset + 8;\r\n\t\t\tc2 = /* node right */ uint32Array[ stride4Offset + 6 ];\n\n\t\t} else {\n\n\t\t\tc1 = /* node right */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tc2 = /* node left */ stride4Offset + 8;\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= /* c2 boundingData */ float32Array[ c2 + splitAxis ] :\r\n\t\t\t\tpoint >= /* c2 boundingData */ float32Array[ c2 + splitAxis + 3 ];\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport const shapecastBuffer = ( function () {\n\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\n\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\n\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\n\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\treturn function shapecastBuffer( stride4Offset,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc = null,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\n\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffsetBuffer( stride4Offset ) {\n\n\t\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\twhile ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) {\n\n\t\t\t\t/* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2;\n\n\t\t\t}\n\n\t\t\treturn /* node offset */ uint32Array[ stride4Offset + 6 ];\n\n\t\t}\n\n\t\tfunction getRightEndOffsetBuffer( stride4Offset ) {\n\n\t\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\twhile ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) {\n\n\t\t\t\t/* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2;\n\n\t\t\t}\n\n\t\t\treturn /* node offset */ uint32Array[ stride4Offset + 6 ] + /* node count */ uint16Array[ stride2Offset + 14 ];\n\n\t\t}\n\n\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\t\tif ( isLeaf && intersectsTriangleFunc ) {\n\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = /* node offset */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tconst count = /* node count */ uint16Array[ stride2Offset + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\n\n\t\t} else {\n\n\t\t\tconst left = /* node left */ stride4Offset + 8;\r\n\t\t\tconst right = /* node right */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\n\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\n\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\n\n\t\t\t\tarrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 );\r\n\t\t\t\tarrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 );\n\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\n\n\t\t\t\tif ( score2 < score1 ) {\n\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\n\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\n\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\n\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 );\n\n\t\t\t}\n\n\t\t\tconst isC1Leaf = ! /* c1 count */ ( uint16Array[ c1 + 15 ] !== 0xffff );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\n\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\n\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffsetBuffer( c1 );\r\n\t\t\t\tconst end = getRightEndOffsetBuffer( c1 );\r\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\n\n\t\t\t} else {\n\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecastBuffer(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c1StopTraversal ) return true;\n\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 );\n\n\t\t\tconst isC2Leaf = ! /* c2 count */ ( uint16Array[ c2 + 15 ] !== 0xffff );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\n\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\n\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffsetBuffer( c2 );\r\n\t\t\t\tconst end = getRightEndOffsetBuffer( c2 );\r\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\n\n\t\t\t} else {\n\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecastBuffer(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c2StopTraversal ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nexport const intersectsGeometryBuffer = ( function () {\n\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\n\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\n\n\treturn function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) {\n\n\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tif ( cachedObb === null ) {\n\n\t\t\tif ( ! geometry.boundingBox ) {\n\n\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\n\n\t\t}\n\n\t\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\t\tif ( isLeaf ) {\n\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\n\n\t\t\tconst offset = /* node offset */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tconst count = /* node count */ uint16Array[ stride2Offset + 14 ];\n\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\t\tif ( geometry.boundsTree ) {\n\n\t\t\t\tarrayToBoxBuffer( /* node boundingData */ stride4Offset, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\n\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\n\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\n\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\n\n\t\t\t\treturn res;\n\n\t\t\t} else {\n\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\n\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\n\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\n\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = /* node left */ stride4Offset + 8;\r\n\t\t\tconst right = /* node right */ uint32Array[ stride4Offset + 6 ];\n\n\t\t\tarrayToBoxBuffer( /* left boundingData */ left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( leftIntersection ) return true;\n\n\t\t\tarrayToBoxBuffer( /* right boundingData */ right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( rightIntersection ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nfunction intersectRayBuffer( stride4Offset, array, ray, target ) {\n\n\tarrayToBoxBuffer( stride4Offset, array, boundingBox );\n\treturn ray.intersectBox( boundingBox, target );\n\n}\n\nconst bufferStack = [];\nlet _prevBuffer;\nlet _float32Array;\nlet _uint16Array;\nlet _uint32Array;\nexport function setBuffer( buffer ) {\n\n\tif ( _prevBuffer ) {\n\n\t\tbufferStack.push( _prevBuffer );\n\n\t}\n\n\t_prevBuffer = buffer;\n\t_float32Array = new Float32Array( buffer );\n\t_uint16Array = new Uint16Array( buffer );\n\t_uint32Array = new Uint32Array( buffer );\n\n}\n\nexport function clearBuffer() {\n\n\t_prevBuffer = null;\n\t_float32Array = null;\n\t_uint16Array = null;\n\t_uint32Array = null;\n\n\tif ( bufferStack.length ) {\n\n\t\tsetBuffer( bufferStack.pop() );\n\n\t}\n\n}\n\nfunction arrayToBoxBuffer( stride4Offset, array, target ) {\n\n\ttarget.min.x = array[ stride4Offset ];\n\ttarget.min.y = array[ stride4Offset + 1 ];\n\ttarget.min.z = array[ stride4Offset + 2 ];\n\n\ttarget.max.x = array[ stride4Offset + 3 ];\n\ttarget.max.y = array[ stride4Offset + 4 ];\n\ttarget.max.z = array[ stride4Offset + 5 ];\n\n}\n","import { Vector3, BufferAttribute } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { buildTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n} from './castFunctions.js';\r\n\r\nimport {\r\n\traycastBuffer,\r\n\traycastFirstBuffer,\r\n\tshapecastBuffer,\r\n\tintersectsGeometryBuffer,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctionsBuffer.js';\r\n\r\n// boundingData \t\t\t\t: 6 float32\r\n// right / offset \t\t\t\t: 1 uint32\r\n// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\nconst BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\nconst IS_LEAFNODE_FLAG = 0xFFFF;\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tfunction finishTree( node ) {\r\n\r\n\t\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! node.count ) {\r\n\r\n\t\t\t\tfinishTree( node.left );\r\n\t\t\t\tfinishTree( node.right );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction countNodes( node ) {\r\n\r\n\t\t\tif ( node.count ) {\r\n\r\n\t\t\t\treturn 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\t\tconst stride4Offset = byteOffset / 4;\r\n\t\t\tconst stride2Offset = byteOffset / 2;\r\n\t\t\tconst isLeaf = ! ! node.count;\r\n\t\t\tconst boundingData = node.boundingData;\r\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = node.offset;\r\n\t\t\t\tconst count = node.count;\r\n\t\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node.left;\r\n\t\t\t\tconst right = node.right;\r\n\t\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\t\tlet nextUnusedPointer;\r\n\t\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlet float32Array;\r\n\t\tlet uint32Array;\r\n\t\tlet uint16Array;\r\n\r\n\t\tconst roots = bvh._roots;\r\n\t\tlet rootData;\r\n\r\n\t\tif ( bvh._isPacked ) {\r\n\r\n\t\t\trootData = roots;\r\n\r\n\t\t} else {\r\n\r\n\t\t\trootData = [];\r\n\t\t\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\t\t\tconst root = roots[ i ];\r\n\t\t\t\tfinishTree( root );\r\n\t\t\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\t\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\t\tpopulateBuffer( 0, root );\r\n\t\t\t\trootData.push( buffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\t\tbvh._isPacked = true;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geo, options = {} ) {\r\n\r\n\t\tif ( ! geo.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geo.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geo.index && geo.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\t\t\tlazyGeneration: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// whether to the pack the data as a buffer or not. The data\r\n\t\t\t// will not be packed if lazyGeneration is true.\r\n\t\t\tpackData: true,\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._isPacked = false;\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildTree( geo, options );\r\n\t\t\tif ( ! options.lazyGeneration && options.packData ) {\r\n\r\n\t\t\t\tthis._roots = MeshBVH.serialize( this, geo, false ).roots;\r\n\t\t\t\tthis._isPacked = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tif ( this._isPacked ) {\r\n\r\n\t\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t\t_traverseBuffer( 0 );\r\n\r\n\t\t\tfunction _traverseBuffer( stride4Offset, depth = 0 ) {\r\n\r\n\t\t\t\tconst stride2Offset = stride4Offset * 2;\r\n\t\t\t\tconst isLeaf = uint16Array[ stride2Offset + 15 ];\r\n\t\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t\tconst offset = uint32Array[ stride4Offset + 6 ];\r\n\t\t\t\t\tconst count = uint16Array[ stride2Offset + 14 ];\r\n\t\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconst left = stride4Offset + BYTES_PER_NODE / 4;\r\n\t\t\t\t\tconst right = uint32Array[ stride4Offset + 6 ];\r\n\t\t\t\t\tconst splitAxis = uint32Array[ stride4Offset + 7 ];\r\n\t\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis, false );\r\n\r\n\t\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t\t_traverseBuffer( left, depth + 1 );\r\n\t\t\t\t\t\t_traverseBuffer( right, depth + 1 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_traverseNode( this._roots[ rootIndex ] );\r\n\r\n\t\t\tfunction _traverseNode( node, depth = 0 ) {\r\n\r\n\t\t\t\tconst isLeaf = ! ! node.count;\r\n\t\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t\tcallback( depth, isLeaf, node.boundingData, node.offset, node.count );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconst stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis, ! ! node.continueGeneration );\r\n\r\n\t\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t\tif ( node.left ) _traverseNode( node.left, depth + 1 );\r\n\t\t\t\t\t\tif ( node.right ) _traverseNode( node.right, depth + 1 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\traycastBuffer( 0, mesh, raycaster, ray, intersects );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\traycast( root, mesh, raycaster, ray, intersects );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tlet result;\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\tresult = raycastFirstBuffer( 0, mesh, raycaster, ray );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresult = raycastFirst( root, mesh, raycaster, ray );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, geometry, geomToMesh ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\tresult = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresult = intersectsGeometry( root, mesh, geometry, geomToMesh );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\tresult = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresult = shapecast( root, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! geom.boundingBox ) {\r\n\r\n\t\t\tgeom.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = geom.attributes.position;\r\n\t\tconst index = geom.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis._oldDepth = - 1;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._boundsTree = null;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tthis._oldDepth = this.depth;\r\n\t\tthis._boundsTree = this.mesh.geometry.boundsTree;\r\n\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( this._boundsTree ) {\r\n\r\n\t\t\tthis._boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( countOrIsUnfinished, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( countOrIsUnfinished, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","xyzFields","Mesh","boundingBox","boxIntersection","LineBasicMaterial","Box3Helper","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAEnC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA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C;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// if the geometry doesn't have a bounding box, then let's politely populate it using\r\n\t// the work we did to determine the BVH root bounds\r\n\tif ( geo.boundingBox == null ) {\r\n\r\n\t\tconst rootBox = new Box3();\r\n\t\tgeo.boundingBox = new Box3();\r\n\r\n\t\tfor ( let root of roots ) {\r\n\r\n\t\t\tgeo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast( nodeIndex32,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc = null,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf && intersectsTriangleFunc ) {\r\n\r\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! geometry.boundingBox ) {\r\n\r\n\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( geometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n","import { Vector3, BufferAttribute } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geo, options = {} ) {\r\n\r\n\t\tif ( ! geo.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geo.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geo.index && geo.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geo, options );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\trefit( geometry ) {\r\n\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t_traverse( 0 );\r\n\r\n\t\t}\n\r\n\t\tfunction _traverse( node32Index ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\tconst leftChange = _traverse( left );\r\n\t\t\t\tconst rightChange = _traverse( right );\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, raycaster, ray );\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, geometry, geomToMesh ) {\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, geomToMesh );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! geom.boundingBox ) {\r\n\r\n\t\t\tgeom.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = geom.attributes.position;\r\n\t\tconst index = geom.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","xyzFields","arrayToBox","Mesh","LineBasic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CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file From 769cacca7e6c9bfbe9f728770a43402421093351 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 18:54:14 -0800 Subject: [PATCH 074/139] Update settings --- example/sculpt.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 56b13895e..96b51b25f 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -31,7 +31,7 @@ const params = { size: 0.1, brush: 'clay', intensity: 50, - maxSteps: 20, + maxSteps: 10, invert: false, symmetrical: true, flatShading: false, @@ -165,7 +165,7 @@ function init() { sculptFolder.add( params, 'brush', [ 'normal', 'clay', 'flatten' ] ); sculptFolder.add( params, 'size' ).min( 0.025 ).max( 0.25 ).step( 0.005 ); sculptFolder.add( params, 'intensity' ).min( 1 ).max( 100 ).step( 1 ); - sculptFolder.add( params, 'maxSteps' ).min( 1 ).max( 50 ).step( 1 ); + sculptFolder.add( params, 'maxSteps' ).min( 1 ).max( 25 ).step( 1 ); sculptFolder.add( params, 'symmetrical' ); sculptFolder.add( params, 'invert' ); sculptFolder.add( params, 'flatShading' ).onChange( value => { From 461a727bc704e142d130b582d72b01c73bd1c70a Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 19:11:52 -0800 Subject: [PATCH 075/139] improve normal generation --- example/sculpt.js | 70 ++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 96b51b25f..5c92cc813 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -407,6 +407,7 @@ function performStroke( point, brushObject, brushOnly = false ) { plane.setFromNormalAndCoplanarPoint( normal, planePoint ); const indexToTriangles = {}; + const triangles = new Set(); indices.forEach( i => { const index = indexAttr.getX( i ); @@ -440,48 +441,67 @@ function performStroke( point, brushObject, brushOnly = false ) { } posAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); - - // save all the triangles that are connected to this vertex - let arr = indexToTriangles[ index ]; - if ( ! arr ) { - - arr = indexToTriangles[ index ] = []; - - } - - arr.push( ~ ~ ( i / 3 ) ); + normalAttr.setXYZ( index, 0, 0, 0 ); + triangles.add( ~ ~ ( i / 3 ) ); } ); // If we found vertices if ( indices.size ) { - // compute the new vertex normal - // TODO: this can be improved by computing the normal vertices in place in - // the buffer then normalizing them and avoiding recomputing the normal for the - // same triangles multiple times + // accumulate the normals in place in the normal buffer const triangle = new THREE.Triangle(); - for ( const index in indexToTriangles ) { + triangles.forEach( tri => { - tempVec.set( 0, 0, 0 ); + const tri3 = tri * 3; + const i0 = tri3 + 0; + const i1 = tri3 + 1; + const i2 = tri3 + 2; - const arr = indexToTriangles[ index ]; - for ( const tri in arr ) { + const v0 = indexAttr.getX( i0 ); + const v1 = indexAttr.getX( i1 ); + const v2 = indexAttr.getX( i2 ); - const i3 = arr[ tri ] * 3; - triangle.a.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 0 ) ); - triangle.b.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 1 ) ); - triangle.c.fromBufferAttribute( posAttr, indexAttr.getX( i3 + 2 ) ); + triangle.a.fromBufferAttribute( posAttr, v0 ); + triangle.b.fromBufferAttribute( posAttr, v1 ); + triangle.c.fromBufferAttribute( posAttr, v2 ); + triangle.getNormal( tempVec2 ); - triangle.getNormal( tempVec2 ); + if ( indices.has( i0 ) ) { + + tempVec.fromBufferAttribute( normalAttr, v0 ); tempVec.add( tempVec2 ); + normalAttr.setXYZ( v0, tempVec.x, tempVec.y, tempVec.z ); } + if ( indices.has( i1 ) ) { + + tempVec.fromBufferAttribute( normalAttr, v1 ); + tempVec.add( tempVec2 ); + normalAttr.setXYZ( v1, tempVec.x, tempVec.y, tempVec.z ); + + } + + if ( indices.has( i2 ) ) { + + tempVec.fromBufferAttribute( normalAttr, v2 ); + tempVec.add( tempVec2 ); + normalAttr.setXYZ( v2, tempVec.x, tempVec.y, tempVec.z ); + + } + + } ); + + // normalize the accumulated normals + indices.forEach( i => { + + const v = indexAttr.getX( i ); + tempVec.fromBufferAttribute( normalAttr, v ); tempVec.normalize(); - normalAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); + normalAttr.setXYZ( v, tempVec.x, tempVec.y, tempVec.z ); - } + } ); posAttr.needsUpdate = true; normalAttr.needsUpdate = true; From c6a5670b6ab3b2a36b2a22a7831d99569ee0d4b6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 19:30:23 -0800 Subject: [PATCH 076/139] simplify triangles --- example/sculpt.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 5c92cc813..06a1ff06a 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -285,6 +285,10 @@ function performStroke( point, brushObject, brushOnly = false ) { const tempVec = new THREE.Vector3(); const tempVec2 = new THREE.Vector3(); const normal = new THREE.Vector3(); + const indexAttr = targetMesh.geometry.index; + const posAttr = targetMesh.geometry.attributes.position; + const normalAttr = targetMesh.geometry.attributes.normal; + const triangles = new Set(); const bvh = targetMesh.geometry.boundsTree; bvh.shapecast( targetMesh, @@ -326,6 +330,7 @@ function performStroke( point, brushObject, brushOnly = false ) { }, ( tri, a, b, c, contained ) => { + triangles.add( ~ ~ ( a / 3 ) ); if ( contained ) { indices.add( a ); @@ -360,9 +365,6 @@ function performStroke( point, brushObject, brushOnly = false ) { ); // Compute the average normal at this point - const indexAttr = targetMesh.geometry.index; - const posAttr = targetMesh.geometry.attributes.position; - const normalAttr = targetMesh.geometry.attributes.normal; const localPoint = new THREE.Vector3(); localPoint.copy( point ).applyMatrix4( inverseMatrix ); @@ -406,8 +408,6 @@ function performStroke( point, brushObject, brushOnly = false ) { const plane = new THREE.Plane(); plane.setFromNormalAndCoplanarPoint( normal, planePoint ); - const indexToTriangles = {}; - const triangles = new Set(); indices.forEach( i => { const index = indexAttr.getX( i ); @@ -442,7 +442,6 @@ function performStroke( point, brushObject, brushOnly = false ) { posAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); normalAttr.setXYZ( index, 0, 0, 0 ); - triangles.add( ~ ~ ( i / 3 ) ); } ); From f8052e0c9ea92caa3c724d2a0a7ed49a18e8087e Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 19:44:08 -0800 Subject: [PATCH 077/139] improve sculpt performance / correctness --- example/sculpt.js | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 06a1ff06a..b826a1977 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -331,29 +331,33 @@ function performStroke( point, brushObject, brushOnly = false ) { ( tri, a, b, c, contained ) => { triangles.add( ~ ~ ( a / 3 ) ); + + const va = indexAttr.getX( a ); + const vb = indexAttr.getX( b ); + const vc = indexAttr.getX( c ); if ( contained ) { - indices.add( a ); - indices.add( b ); - indices.add( c ); + indices.add( va ); + indices.add( vb ); + indices.add( vc ); } else { if ( sphere.containsPoint( tri.a ) ) { - indices.add( a ); + indices.add( va ); } if ( sphere.containsPoint( tri.b ) ) { - indices.add( b ); + indices.add( vb ); } if ( sphere.containsPoint( tri.c ) ) { - indices.add( c ); + indices.add( vc ); } @@ -370,9 +374,8 @@ function performStroke( point, brushObject, brushOnly = false ) { const planePoint = new THREE.Vector3(); let totalPoints = 0; - indices.forEach( i => { + indices.forEach( index => { - const index = indexAttr.getX( i ); tempVec.fromBufferAttribute( normalAttr, index ); normal.add( tempVec ); @@ -404,13 +407,12 @@ function performStroke( point, brushObject, brushOnly = false ) { } // perform vertex adjustment - const targetHeight = params.intensity * 0.000025; + const targetHeight = params.intensity * 0.0001; const plane = new THREE.Plane(); plane.setFromNormalAndCoplanarPoint( normal, planePoint ); - indices.forEach( i => { + indices.forEach( index => { - const index = indexAttr.getX( i ); tempVec.fromBufferAttribute( posAttr, index ); // compute the offset intensity @@ -423,12 +425,12 @@ function performStroke( point, brushObject, brushOnly = false ) { intensity = Math.pow( intensity, 3 ); const planeDist = plane.distanceToPoint( tempVec ); - const clampedIntensity = negated * Math.min( intensity * 2, 0.5 ) * 2.0; - tempVec.addScaledVector( normal, clampedIntensity * targetHeight - negated * planeDist * clampedIntensity * 0.1 ); + const clampedIntensity = negated * Math.min( intensity * 4, 1.0 ); + tempVec.addScaledVector( normal, clampedIntensity * targetHeight - negated * planeDist * clampedIntensity * 0.3 ); } else if ( params.brush === 'normal' ) { - intensity = Math.pow( intensity, 3 ); + intensity = Math.pow( intensity, 2 ); tempVec.addScaledVector( normal, negated * intensity * targetHeight ); } else if ( params.brush === 'flatten' ) { @@ -466,7 +468,7 @@ function performStroke( point, brushObject, brushOnly = false ) { triangle.c.fromBufferAttribute( posAttr, v2 ); triangle.getNormal( tempVec2 ); - if ( indices.has( i0 ) ) { + if ( indices.has( v0 ) ) { tempVec.fromBufferAttribute( normalAttr, v0 ); tempVec.add( tempVec2 ); @@ -474,7 +476,7 @@ function performStroke( point, brushObject, brushOnly = false ) { } - if ( indices.has( i1 ) ) { + if ( indices.has( v1 ) ) { tempVec.fromBufferAttribute( normalAttr, v1 ); tempVec.add( tempVec2 ); @@ -482,7 +484,7 @@ function performStroke( point, brushObject, brushOnly = false ) { } - if ( indices.has( i2 ) ) { + if ( indices.has( v2 ) ) { tempVec.fromBufferAttribute( normalAttr, v2 ); tempVec.add( tempVec2 ); @@ -493,12 +495,11 @@ function performStroke( point, brushObject, brushOnly = false ) { } ); // normalize the accumulated normals - indices.forEach( i => { + indices.forEach( index => { - const v = indexAttr.getX( i ); - tempVec.fromBufferAttribute( normalAttr, v ); + tempVec.fromBufferAttribute( normalAttr, index ); tempVec.normalize(); - normalAttr.setXYZ( v, tempVec.x, tempVec.y, tempVec.z ); + normalAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); } ); From 21a6a293661345ae46f99e0da9f90f516fb4d0bc Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 19:52:40 -0800 Subject: [PATCH 078/139] Separate normals update --- example/sculpt.js | 97 +++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index b826a1977..2247649bf 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -283,7 +283,6 @@ function performStroke( point, brushObject, brushOnly = false ) { // Collect the intersected vertices const indices = new Set(); const tempVec = new THREE.Vector3(); - const tempVec2 = new THREE.Vector3(); const normal = new THREE.Vector3(); const indexAttr = targetMesh.geometry.index; const posAttr = targetMesh.geometry.attributes.position; @@ -447,69 +446,83 @@ function performStroke( point, brushObject, brushOnly = false ) { } ); + + // TODO: refit bounds here once it's optimized so we don't miss raycasts + // due to out of date bounds + + // If we found vertices if ( indices.size ) { - // accumulate the normals in place in the normal buffer - const triangle = new THREE.Triangle(); - triangles.forEach( tri => { + posAttr.needsUpdate = true; + updateNormals( triangles, indices ); - const tri3 = tri * 3; - const i0 = tri3 + 0; - const i1 = tri3 + 1; - const i2 = tri3 + 2; + } - const v0 = indexAttr.getX( i0 ); - const v1 = indexAttr.getX( i1 ); - const v2 = indexAttr.getX( i2 ); +} - triangle.a.fromBufferAttribute( posAttr, v0 ); - triangle.b.fromBufferAttribute( posAttr, v1 ); - triangle.c.fromBufferAttribute( posAttr, v2 ); - triangle.getNormal( tempVec2 ); +function updateNormals( triangles, indices ) { - if ( indices.has( v0 ) ) { + const tempVec = new THREE.Vector3(); + const tempVec2 = new THREE.Vector3(); + const indexAttr = targetMesh.geometry.index; + const posAttr = targetMesh.geometry.attributes.position; + const normalAttr = targetMesh.geometry.attributes.normal; - tempVec.fromBufferAttribute( normalAttr, v0 ); - tempVec.add( tempVec2 ); - normalAttr.setXYZ( v0, tempVec.x, tempVec.y, tempVec.z ); + // accumulate the normals in place in the normal buffer + const triangle = new THREE.Triangle(); + triangles.forEach( tri => { - } + const tri3 = tri * 3; + const i0 = tri3 + 0; + const i1 = tri3 + 1; + const i2 = tri3 + 2; - if ( indices.has( v1 ) ) { + const v0 = indexAttr.getX( i0 ); + const v1 = indexAttr.getX( i1 ); + const v2 = indexAttr.getX( i2 ); - tempVec.fromBufferAttribute( normalAttr, v1 ); - tempVec.add( tempVec2 ); - normalAttr.setXYZ( v1, tempVec.x, tempVec.y, tempVec.z ); + triangle.a.fromBufferAttribute( posAttr, v0 ); + triangle.b.fromBufferAttribute( posAttr, v1 ); + triangle.c.fromBufferAttribute( posAttr, v2 ); + triangle.getNormal( tempVec2 ); - } + if ( indices.has( v0 ) ) { - if ( indices.has( v2 ) ) { + tempVec.fromBufferAttribute( normalAttr, v0 ); + tempVec.add( tempVec2 ); + normalAttr.setXYZ( v0, tempVec.x, tempVec.y, tempVec.z ); - tempVec.fromBufferAttribute( normalAttr, v2 ); - tempVec.add( tempVec2 ); - normalAttr.setXYZ( v2, tempVec.x, tempVec.y, tempVec.z ); + } - } + if ( indices.has( v1 ) ) { - } ); + tempVec.fromBufferAttribute( normalAttr, v1 ); + tempVec.add( tempVec2 ); + normalAttr.setXYZ( v1, tempVec.x, tempVec.y, tempVec.z ); - // normalize the accumulated normals - indices.forEach( index => { + } - tempVec.fromBufferAttribute( normalAttr, index ); - tempVec.normalize(); - normalAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); + if ( indices.has( v2 ) ) { - } ); + tempVec.fromBufferAttribute( normalAttr, v2 ); + tempVec.add( tempVec2 ); + normalAttr.setXYZ( v2, tempVec.x, tempVec.y, tempVec.z ); - posAttr.needsUpdate = true; - normalAttr.needsUpdate = true; + } - // TODO: refit bounds here once it's optimized so we don't miss raycasts - // due to out of date bounds + } ); - } + // normalize the accumulated normals + indices.forEach( index => { + + tempVec.fromBufferAttribute( normalAttr, index ); + tempVec.normalize(); + normalAttr.setXYZ( index, tempVec.x, tempVec.y, tempVec.z ); + + } ); + + normalAttr.needsUpdate = true; } From e192656958fdea20a6c924fe651157d213c2338a Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 19:59:28 -0800 Subject: [PATCH 079/139] Only update the normals once --- example/sculpt.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 2247649bf..9d5b4bab2 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -271,7 +271,7 @@ function init() { } // Run the perform the brush movement -function performStroke( point, brushObject, brushOnly = false ) { +function performStroke( point, brushObject, brushOnly = false, accumulatedTriangles = new Set(), accumulatedIndices = new Set() ) { const inverseMatrix = new THREE.Matrix4(); inverseMatrix.copy( targetMesh.matrixWorld ).invert(); @@ -329,7 +329,9 @@ function performStroke( point, brushObject, brushOnly = false ) { }, ( tri, a, b, c, contained ) => { - triangles.add( ~ ~ ( a / 3 ) ); + const triIndex = ~ ~ ( a / 3 ); + triangles.add( triIndex ); + accumulatedTriangles.add( triIndex ); const va = indexAttr.getX( a ); const vb = indexAttr.getX( b ); @@ -340,23 +342,30 @@ function performStroke( point, brushObject, brushOnly = false ) { indices.add( vb ); indices.add( vc ); + accumulatedIndices.add( va ); + accumulatedIndices.add( vb ); + accumulatedIndices.add( vc ); + } else { if ( sphere.containsPoint( tri.a ) ) { indices.add( va ); + accumulatedIndices.add( va ); } if ( sphere.containsPoint( tri.b ) ) { indices.add( vb ); + accumulatedIndices.add( vb ); } if ( sphere.containsPoint( tri.c ) ) { indices.add( vc ); + accumulatedIndices.add( vc ); } @@ -446,16 +455,10 @@ function performStroke( point, brushObject, brushOnly = false ) { } ); - - // TODO: refit bounds here once it's optimized so we don't miss raycasts - // due to out of date bounds - - // If we found vertices if ( indices.size ) { posAttr.needsUpdate = true; - updateNormals( triangles, indices ); } @@ -598,6 +601,8 @@ function render() { // perform multiple iterations toward the current mouse pose for a consistent stroke // TODO: recast here so he cursor is on the surface of the model which requires faster // refitting of the model + const changedTriangles = new Set(); + const changedIndices = new Set(); while ( castDist > step && mdist > params.size * 200 / hit.distance ) { lastMouse.lerp( mouse, percent ); @@ -605,12 +610,12 @@ function render() { castDist -= step; mdist -= mstep; - performStroke( lastCastPose, brush, false ); + performStroke( lastCastPose, brush, false, changedTriangles, changedIndices ); if ( params.symmetrical ) { lastCastPose.x *= - 1; - performStroke( lastCastPose, symmetryBrush, false ); + performStroke( lastCastPose, symmetryBrush, false, changedTriangles, changedIndices ); lastCastPose.x *= - 1; } @@ -624,9 +629,13 @@ function render() { } - // refit the bounds if we adjusted the mesh + // refit the bounds and update the normals if we adjusted the mesh if ( stepCount > 0 ) { + // TODO: refit bounds and normal updates should probably happen after every stroke + // so it's up to date for the next one because both of those are used when updating + // the model but it's faster to do them here. + updateNormals( changedTriangles, changedIndices ); targetMesh.geometry.boundsTree.refit( targetMesh.geometry ); bvhHelper.update(); From ec578a6832cf5813b79289f9756bd61bc976f0e2 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 20:36:02 -0800 Subject: [PATCH 080/139] Remove ability to shapecast triangle function to be null --- src/MeshBVH.js | 3 +++ src/castFunctions.template.js | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 4f48a7610..e3577ba75 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -311,6 +311,9 @@ export default class MeshBVH { shapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) { + // default the triangle intersection function + intersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained ); + let result = false; for ( const root of this._roots ) { diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 7eb002650..860ef9333 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -157,10 +157,11 @@ export const shapecast = ( function () { } - return function shapecast( nodeIndex32, + return function shapecast( + nodeIndex32, mesh, intersectsBoundsFunc, - intersectsTriangleFunc = null, + intersectsTriangleFunc, nodeScoreFunc = null, depth = 0, triangle = _triangle, @@ -207,7 +208,7 @@ export const shapecast = ( function () { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; const isLeaf = IS_LEAF( nodeIndex16 ); - if ( isLeaf && intersectsTriangleFunc ) { + if ( isLeaf ) { const geometry = mesh.geometry; const offset = OFFSET( nodeIndex32 ); From 53713515d45d6635f613c4f7d0de5a20f220c1cf Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 20:40:36 -0800 Subject: [PATCH 081/139] update cast functions --- src/castFunctions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/castFunctions.js b/src/castFunctions.js index 052f5dc57..70e25f059 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -155,10 +155,11 @@ export const shapecast = ( function () { } - return function shapecast( nodeIndex32, + return function shapecast( + nodeIndex32, mesh, intersectsBoundsFunc, - intersectsTriangleFunc = null, + intersectsTriangleFunc, nodeScoreFunc = null, depth = 0, triangle = _triangle, @@ -205,7 +206,7 @@ export const shapecast = ( function () { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); - if ( isLeaf && intersectsTriangleFunc ) { + if ( isLeaf ) { const geometry = mesh.geometry; const offset = uint32Array[ nodeIndex32 + 6 ]; From 397e0fe7c944700d8e294acf7091e469bfd3f7b1 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 21:17:43 -0800 Subject: [PATCH 082/139] build --- example/bundle/asyncGenerate.4a48c6e8.js | 4 ++-- example/bundle/asyncGenerate.html | 3 +-- example/bundle/characterMovement.725f956b.js | 4 ++-- example/bundle/collectTriangles.9c45819a.js | 4 ++-- example/bundle/collectTriangles.html | 3 +-- example/bundle/distancecast.4107d8f2.js | 4 ++-- example/bundle/distancecast.html | 3 +-- example/bundle/generateAsync.worker.13d14241.js | 4 ++-- example/bundle/physics.50b811f1.js | 4 ++-- example/bundle/randomSampleDebug.32ad2b43.js | 4 ++-- example/bundle/raycast.88074831.js | 4 ++-- example/bundle/raycast.html | 3 +-- example/bundle/sculpt.493e9c78.js | 6 +++--- example/bundle/selection.383a520f.js | 4 ++-- example/bundle/shapecast.b93a7fe2.js | 4 ++-- umd/index.js | 10 +++++++--- umd/index.js.map | 2 +- 17 files changed, 35 insertions(+), 35 deletions(-) diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index 4a6fccf76..7e860e9c9 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -28,9 +28,9 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var i=this.worker;return this.running=!0,new Promise(function(o,a){i.onmessage=function(t){n.running=!1,i.onmessage=null;var s=t.data,u=s.serialized,f=s.position,l=s.error;if(l)a(new Error(l));else{var d=e.default.deserialize(u,r,!1);r.attributes.position.array=f,r.index&&(r.index.array=u.index),o(d)}};var s=r.index?r.index.array:null,u=r.attributes.position.array;if(u.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var f=[u];s&&f.push(s),i.postMessage({index:s,position:u,options:t},f.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),r}();exports.GenerateMeshBVHWorker=o; },{"../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { diff --git a/example/bundle/asyncGenerate.html b/example/bundle/asyncGenerate.html index c05dcda16..079691e54 100644 --- a/example/bundle/asyncGenerate.html +++ b/example/bundle/asyncGenerate.html @@ -1,2 +1 @@ -THREE.js BVH Geometry Collect Triangles
- \ No newline at end of file +THREE.js BVH Geometry Collect Triangles
\ No newline at end of file diff --git a/example/bundle/characterMovement.725f956b.js b/example/bundle/characterMovement.725f956b.js index 8443ff303..1f77ed45f 100644 --- a/example/bundle/characterMovement.725f956b.js +++ b/example/bundle/characterMovement.725f956b.js @@ -36,9 +36,9 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iTHREE.js BVH Geometry Collect Triangles - \ No newline at end of file +THREE.js BVH Geometry Collect Triangles \ No newline at end of file diff --git a/example/bundle/distancecast.4107d8f2.js b/example/bundle/distancecast.4107d8f2.js index 470d0c5e7..84e02652c 100644 --- a/example/bundle/distancecast.4107d8f2.js +++ b/example/bundle/distancecast.4107d8f2.js @@ -561,9 +561,9 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return rTHREE.js BVH Geometry Closest Distance
- \ No newline at end of file +THREE.js BVH Geometry Closest Distance
\ No newline at end of file diff --git a/example/bundle/generateAsync.worker.13d14241.js b/example/bundle/generateAsync.worker.13d14241.js index e32f4230c..71a16420a 100644 --- a/example/bundle/generateAsync.worker.13d14241.js +++ b/example/bundle/generateAsync.worker.13d14241.js @@ -23,9 +23,9 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return rTHREE.js BVH Geometry Raycasting - \ No newline at end of file +THREE.js BVH Geometry Raycasting \ No newline at end of file diff --git a/example/bundle/sculpt.493e9c78.js b/example/bundle/sculpt.493e9c78.js index 5ac713f4f..fc04905db 100644 --- a/example/bundle/sculpt.493e9c78.js +++ b/example/bundle/sculpt.493e9c78.js @@ -557,9 +557,9 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i2&&void 0!==arguments[2]&&arguments[2],o=new l.Matrix4;o.copy(i.matrixWorld).invert();var t=new l.Sphere;t.center.copy(e).applyMatrix4(o),t.radius=z.size;var n=new Set,u=new l.Vector3,a=new l.Vector3,d=new l.Vector3;i.geometry.boundsTree.shapecast(i,function(e){var r=t.intersectsBox(e),s=e.min,o=e.max;if(r){for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)for(var a=0;a<=1;a++)if(u.set(0===i?s.x:o.x,0===n?s.y:o.y,0===a?s.z:o.z),!t.containsPoint(u))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,o,i){return i?(n.add(r),n.add(s),n.add(o)):(t.containsPoint(e.a)&&n.add(r),t.containsPoint(e.b)&&n.add(s),t.containsPoint(e.c)&&n.add(o)),!1});var c=i.geometry.index,m=i.geometry.attributes.position,p=i.geometry.attributes.normal,f=new l.Vector3;f.copy(e).applyMatrix4(o);var q=new l.Vector3,y=0;if(n.forEach(function(e){var r=c.getX(e);u.fromBufferAttribute(p,r),d.add(u),s||(y++,u.fromBufferAttribute(m,r),q.add(u))}),d.normalize(),r.quaternion.setFromUnitVectors(h,d),y&&q.multiplyScalar(1/y),!s){var g=25e-6*z.intensity,w=new l.Plane;w.setFromNormalAndCoplanarPoint(d,q);var b={};if(n.forEach(function(e){var r=c.getX(e);u.fromBufferAttribute(m,r);var s=u.distanceTo(f),o=z.invert?-1:1,t=1-s/z.size;if("clay"===z.brush){t=Math.pow(t,3);var i=w.distanceToPoint(u),n=o*Math.min(2*t,.5)*2;u.addScaledVector(d,n*g-o*i*n*.1)}else if("normal"===z.brush)t=Math.pow(t,3),u.addScaledVector(d,o*t*g);else if("flatten"===z.brush){t=Math.pow(t,2);var a=w.distanceToPoint(u);u.addScaledVector(d,-a*t*z.intensity*.01*.5)}m.setXYZ(r,u.x,u.y,u.z);var l=b[r];l||(l=b[r]=[]),l.push(~~(e/3))}),n.size){var v=new l.Triangle;for(var x in b){u.set(0,0,0);var M=b[x];for(var S in M){var B=3*M[S];v.a.fromBufferAttribute(m,c.getX(B+0)),v.b.fromBufferAttribute(m,c.getX(B+1)),v.c.fromBufferAttribute(m,c.getX(B+2)),v.getNormal(a),u.add(a)}u.normalize(),p.setXYZ(x,u.x,u.y,u.z)}m.needsUpdate=!0,p.needsUpdate=!0}}}function E(){if(requestAnimationFrame(E),e.begin(),t.active)n.visible=!1,M.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(w,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(z.size,z.size,.1),n.position.copy(c.point),u.visible=z.symmetrical,u.scale.set(z.size,z.size,.1),u.position.copy(c.point),u.position.x*=-1,t.enabled=!1,M.x===1/0&&M.copy(c.point),v||x){for(var m=(w.x-b.x)*window.innerWidth*window.devicePixelRatio,p=(w.y-b.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(M),q=.15*z.size,y=Math.max(q/f,1/z.maxSteps),g=j*y,h=0;f>q&&j>200*z.size/c.distance&&(b.lerp(w,y),M.lerp(c.point,y),f-=q,j-=g,P(M,n,!1),z.symmetrical&&(M.x*=-1,P(M,u,!1),M.x*=-1),!(++h>z.maxSteps)););h>0?(i.geometry.boundsTree.refit(i.geometry),a.update()):(P(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,P(c.point,u,!0),c.point.x*=-1))}else P(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,P(c.point,u,!0),c.point.x*=-1),b.copy(w),M.copy(c.point);else t.enabled=!0,n.visible=!1,u.visible=!1,b.copy(w),M.setScalar(1/0)}x=v,o.render(r,s),e.end()}B(),E(); +"use strict";require("core-js/modules/es6.array.copy-within"),require("core-js/modules/es6.array.fill"),require("core-js/modules/es6.array.find"),require("core-js/modules/es6.array.find-index"),require("core-js/modules/es7.array.flat-map"),require("core-js/modules/es6.array.from"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.array.iterator"),require("core-js/modules/es6.array.of"),require("core-js/modules/es6.array.sort"),require("core-js/modules/es6.array.species"),require("core-js/modules/es6.date.to-json"),require("core-js/modules/es6.date.to-primitive"),require("core-js/modules/es6.function.has-instance"),require("core-js/modules/es6.function.name"),require("core-js/modules/es6.map"),require("core-js/modules/es6.math.acosh"),require("core-js/modules/es6.math.asinh"),require("core-js/modules/es6.math.atanh"),require("core-js/modules/es6.math.cbrt"),require("core-js/modules/es6.math.clz32"),require("core-js/modules/es6.math.cosh"),require("core-js/modules/es6.math.expm1"),require("core-js/modules/es6.math.fround"),require("core-js/modules/es6.math.hypot"),require("core-js/modules/es6.math.imul"),require("core-js/modules/es6.math.log1p"),require("core-js/modules/es6.math.log10"),require("core-js/modules/es6.math.log2"),require("core-js/modules/es6.math.sign"),require("core-js/modules/es6.math.sinh"),require("core-js/modules/es6.math.tanh"),require("core-js/modules/es6.math.trunc"),require("core-js/modules/es6.number.constructor"),require("core-js/modules/es6.number.epsilon"),require("core-js/modules/es6.number.is-finite"),require("core-js/modules/es6.number.is-integer"),require("core-js/modules/es6.number.is-nan"),require("core-js/modules/es6.number.is-safe-integer"),require("core-js/modules/es6.number.max-safe-integer"),require("core-js/modules/es6.number.min-safe-integer"),require("core-js/modules/es6.number.parse-float"),require("core-js/modules/es6.number.parse-int"),require("core-js/modules/es6.object.assign"),require("core-js/modules/es7.object.define-getter"),require("core-js/modules/es7.object.define-setter"),require("core-js/modules/es7.object.entries"),require("core-js/modules/es6.object.freeze"),require("core-js/modules/es6.object.get-own-property-descriptor"),require("core-js/modules/es7.object.get-own-property-descriptors"),require("core-js/modules/es6.object.get-own-property-names"),require("core-js/modules/es6.object.get-prototype-of"),require("core-js/modules/es7.object.lookup-getter"),require("core-js/modules/es7.object.lookup-setter"),require("core-js/modules/es6.object.prevent-extensions"),require("core-js/modules/es6.object.to-string"),require("core-js/modules/es6.object.is"),require("core-js/modules/es6.object.is-frozen"),require("core-js/modules/es6.object.is-sealed"),require("core-js/modules/es6.object.is-extensible"),require("core-js/modules/es6.object.keys"),require("core-js/modules/es6.object.seal"),require("core-js/modules/es6.object.set-prototype-of"),require("core-js/modules/es7.object.values"),require("core-js/modules/es6.promise"),require("core-js/modules/es7.promise.finally"),require("core-js/modules/es6.reflect.apply"),require("core-js/modules/es6.reflect.construct"),require("core-js/modules/es6.reflect.define-property"),require("core-js/modules/es6.reflect.delete-property"),require("core-js/modules/es6.reflect.get"),require("core-js/modules/es6.reflect.get-own-property-descriptor"),require("core-js/modules/es6.reflect.get-prototype-of"),require("core-js/modules/es6.reflect.has"),require("core-js/modules/es6.reflect.is-extensible"),require("core-js/modules/es6.reflect.own-keys"),require("core-js/modules/es6.reflect.prevent-extensions"),require("core-js/modules/es6.reflect.set"),require("core-js/modules/es6.reflect.set-prototype-of"),require("core-js/modules/es6.regexp.constructor"),require("core-js/modules/es6.regexp.flags"),require("core-js/modules/es6.regexp.match"),require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es6.regexp.split"),require("core-js/modules/es6.regexp.search"),require("core-js/modules/es6.regexp.to-string"),require("core-js/modules/es6.set"),require("core-js/modules/es6.symbol"),require("core-js/modules/es7.symbol.async-iterator"),require("core-js/modules/es6.string.anchor"),require("core-js/modules/es6.string.big"),require("core-js/modules/es6.string.blink"),require("core-js/modules/es6.string.bold"),require("core-js/modules/es6.string.code-point-at"),require("core-js/modules/es6.string.ends-with"),require("core-js/modules/es6.string.fixed"),require("core-js/modules/es6.string.fontcolor"),require("core-js/modules/es6.string.fontsize"),require("core-js/modules/es6.string.from-code-point"),require("core-js/modules/es6.string.includes"),require("core-js/modules/es6.string.italics"),require("core-js/modules/es6.string.iterator"),require("core-js/modules/es6.string.link"),require("core-js/modules/es7.string.pad-start"),require("core-js/modules/es7.string.pad-end"),require("core-js/modules/es6.string.raw"),require("core-js/modules/es6.string.repeat"),require("core-js/modules/es6.string.small"),require("core-js/modules/es6.string.starts-with"),require("core-js/modules/es6.string.strike"),require("core-js/modules/es6.string.sub"),require("core-js/modules/es6.string.sup"),require("core-js/modules/es7.string.trim-left"),require("core-js/modules/es7.string.trim-right"),require("core-js/modules/es6.typed.array-buffer"),require("core-js/modules/es6.typed.int8-array"),require("core-js/modules/es6.typed.uint8-array"),require("core-js/modules/es6.typed.uint8-clamped-array"),require("core-js/modules/es6.typed.int16-array"),require("core-js/modules/es6.typed.uint16-array"),require("core-js/modules/es6.typed.int32-array"),require("core-js/modules/es6.typed.uint32-array"),require("core-js/modules/es6.typed.float32-array"),require("core-js/modules/es6.typed.float64-array"),require("core-js/modules/es6.weak-map"),require("core-js/modules/es6.weak-set"),require("core-js/modules/web.timers"),require("core-js/modules/web.immediate"),require("core-js/modules/web.dom.iterable"),require("regenerator-runtime/runtime");var e,r,s,t,o,i,n,u,a,d=y(require("stats.js/src/Stats")),c=q(require("dat.gui")),l=q(require("three")),m=require("three/examples/jsm/controls/OrbitControls.js"),p=require("three/examples/jsm/utils/BufferGeometryUtils.js"),j=require("../src/index.js");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function q(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=f();if(r&&r.has(e))return r.get(e);var s={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=t?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(s,o,i):s[o]=e[o]}return s.default=e,r&&r.set(e,s),s}function y(e){return e&&e.__esModule?e:{default:e}}l.Mesh.prototype.raycast=j.acceleratedRaycast,l.BufferGeometry.prototype.computeBoundsTree=j.computeBoundsTree,l.BufferGeometry.prototype.disposeBoundsTree=j.disposeBoundsTree;var g,h=new l.Vector3(0,0,1),w=new l.Vector2,b=new l.Vector2,v=!1,x=!1,M=new l.Vector3,z={size:.1,brush:"clay",intensity:50,maxSteps:10,invert:!1,symmetrical:!0,flatShading:!1,depth:10,displayHelper:!1};function S(){i&&(i.geometry.dispose(),i.material.dispose(),r.remove(i)),g||(g=(new l.TextureLoader).load("../textures/skinHazardousarts2.jpg"));var e=new l.IcosahedronBufferGeometry(1,100);e.deleteAttribute("uv"),(e=p.BufferGeometryUtils.mergeVertices(e)).attributes.position.setUsage(l.DynamicDrawUsage),e.attributes.normal.setUsage(l.DynamicDrawUsage),e.computeBoundsTree(),(i=new l.Mesh(e,new l.MeshMatcapMaterial({flatShading:z.flatShading,matcap:g}))).material.matcap.encoding=l.sRGBEncoding,i.frustumCulled=!1,r.add(i),a||((a=new j.MeshBVHVisualizer(i,z.depth)).visible=z.displayHelper,r.add(a)),a.mesh=i,a.update()}function B(){(t=new l.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),t.setClearColor(1251612,1),t.gammaOutput=!0,document.body.appendChild(t.domElement),(r=new l.Scene).fog=new l.Fog(1251612,20,60);var p=new l.DirectionalLight(16777215,.5);p.position.set(1,1,1),r.add(p),r.add(new l.AmbientLight(16777215,.4)),S();for(var j=[new l.Vector3,new l.Vector3(0,0,1)],f=0;f<50;f++){var q=f+1,y=Math.sin(2*Math.PI*f/50),g=Math.cos(2*Math.PI*f/50),h=Math.sin(2*Math.PI*q/50),b=Math.cos(2*Math.PI*q/50);j.push(new l.Vector3(y,g,0),new l.Vector3(h,b,0))}(n=new l.LineSegments).geometry.setFromPoints(j),n.material.color.set(16485376),r.add(n),u=n.clone(),r.add(u),(s=new l.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,3),s.far=100,s.updateProjectionMatrix(),(o=new m.OrbitControls(s,t.domElement)).minDistance=1.5,e=new d.default,document.body.appendChild(e.dom);var x=new c.GUI,M=x.addFolder("Sculpting");M.add(z,"brush",["normal","clay","flatten"]),M.add(z,"size").min(.025).max(.25).step(.005),M.add(z,"intensity").min(1).max(100).step(1),M.add(z,"maxSteps").min(1).max(25).step(1),M.add(z,"symmetrical"),M.add(z,"invert"),M.add(z,"flatShading").onChange(function(e){i.material.flatShading=e,i.material.needsUpdate=!0}),M.open();var B=x.addFolder("BVH Helper");B.add(z,"depth").min(1).max(20).step(1).onChange(function(e){a.depth=parseFloat(e),a.update()}),B.add(z,"displayHelper").onChange(function(e){a.visible=e}),B.open(),x.add({reset:S},"reset"),x.add({rebuildBVH:function(){i.geometry.computeBoundsTree(),a.update()}},"rebuildBVH"),x.open(),o.addEventListener("start",function(){this.active=!0}),o.addEventListener("end",function(){this.active=!1}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("mousemove",function(e){w.x=e.clientX/window.innerWidth*2-1,w.y=-e.clientY/window.innerHeight*2+1}),window.addEventListener("mousedown",function(e){v=Boolean(1&e.buttons)}),window.addEventListener("mouseup",function(e){v=Boolean(1&e.buttons)}),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),z.size+=1e-4*r,z.size=Math.max(Math.min(z.size,.25),.025),x.updateDisplay()})}function E(e,r){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Set,n=new l.Matrix4;n.copy(i.matrixWorld).invert();var u=new l.Sphere;u.center.copy(e).applyMatrix4(n),u.radius=z.size;var a=new Set,d=new l.Vector3,c=new l.Vector3,m=i.geometry.index,p=i.geometry.attributes.position,f=i.geometry.attributes.normal,q=new Set;i.geometry.boundsTree.shapecast(i,function(e){var r=u.intersectsBox(e),s=e.min,t=e.max;if(r){for(var o=0;o<=1;o++)for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)if(d.set(0===o?s.x:t.x,0===i?s.y:t.y,0===n?s.z:t.z),!u.containsPoint(d))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,i,n){var d=~~(r/3);q.add(d),t.add(d);var c=m.getX(r),l=m.getX(s),p=m.getX(i);return n?(a.add(c),a.add(l),a.add(p),o.add(c),o.add(l),o.add(p)):(u.containsPoint(e.a)&&(a.add(c),o.add(c)),u.containsPoint(e.b)&&(a.add(l),o.add(l)),u.containsPoint(e.c)&&(a.add(p),o.add(p))),!1});var y=new l.Vector3;y.copy(e).applyMatrix4(n);var g=new l.Vector3,w=0;if(a.forEach(function(e){d.fromBufferAttribute(f,e),c.add(d),s||(w++,d.fromBufferAttribute(p,e),g.add(d))}),c.normalize(),r.quaternion.setFromUnitVectors(h,c),w&&g.multiplyScalar(1/w),!s){var b=1e-4*z.intensity,v=new l.Plane;v.setFromNormalAndCoplanarPoint(c,g),a.forEach(function(e){d.fromBufferAttribute(p,e);var r=d.distanceTo(y),s=z.invert?-1:1,t=1-r/z.size;if("clay"===z.brush){t=Math.pow(t,3);var o=v.distanceToPoint(d),i=s*Math.min(4*t,1);d.addScaledVector(c,i*b-s*o*i*.3)}else if("normal"===z.brush)t=Math.pow(t,2),d.addScaledVector(c,s*t*b);else if("flatten"===z.brush){t=Math.pow(t,2);var n=v.distanceToPoint(d);d.addScaledVector(c,-n*t*z.intensity*.01*.5)}p.setXYZ(e,d.x,d.y,d.z),f.setXYZ(e,0,0,0)}),a.size&&(p.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active)n.visible=!1,M.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(w,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(z.size,z.size,.1),n.position.copy(c.point),u.visible=z.symmetrical,u.scale.set(z.size,z.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,M.x===1/0&&M.copy(c.point),v||x){for(var m=(w.x-b.x)*window.innerWidth*window.devicePixelRatio,p=(w.y-b.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(M),q=.15*z.size,y=Math.max(q/f,1/z.maxSteps),g=j*y,h=0,S=new Set,B=new Set;f>q&&j>200*z.size/c.distance&&(b.lerp(w,y),M.lerp(c.point,y),f-=q,j-=g,E(M,n,!1,S,B),z.symmetrical&&(M.x*=-1,E(M,u,!1,S,B),M.x*=-1),!(++h>z.maxSteps)););h>0?(P(S,B),i.geometry.boundsTree.refit(i.geometry),a.update()):(E(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1))}else E(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1),b.copy(w),M.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,b.copy(w),M.setScalar(1/0)}x=v,t.render(r,s),e.end()}B(),V(); },{"core-js/modules/es6.array.copy-within":"tWTB","core-js/modules/es6.array.fill":"hUQ6","core-js/modules/es6.array.find":"Qppk","core-js/modules/es6.array.find-index":"sVmK","core-js/modules/es7.array.flat-map":"I8vV","core-js/modules/es6.array.from":"RRcs","core-js/modules/es7.array.includes":"TLss","core-js/modules/es6.array.iterator":"wVEN","core-js/modules/es6.array.of":"RB6b","core-js/modules/es6.array.sort":"nrVf","core-js/modules/es6.array.species":"smn3","core-js/modules/es6.date.to-json":"Gj6n","core-js/modules/es6.date.to-primitive":"jQnQ","core-js/modules/es6.function.has-instance":"a7bX","core-js/modules/es6.function.name":"N3yi","core-js/modules/es6.map":"ioKM","core-js/modules/es6.math.acosh":"py3M","core-js/modules/es6.math.asinh":"ob11","core-js/modules/es6.math.atanh":"iUik","core-js/modules/es6.math.cbrt":"YRuK","core-js/modules/es6.math.clz32":"R2Qc","core-js/modules/es6.math.cosh":"nEse","core-js/modules/es6.math.expm1":"AmoX","core-js/modules/es6.math.fround":"vmlq","core-js/modules/es6.math.hypot":"kLut","core-js/modules/es6.math.imul":"A8J8","core-js/modules/es6.math.log1p":"qtpC","core-js/modules/es6.math.log10":"VUW8","core-js/modules/es6.math.log2":"Jo9J","core-js/modules/es6.math.sign":"mZl9","core-js/modules/es6.math.sinh":"m0zb","core-js/modules/es6.math.tanh":"Fnqw","core-js/modules/es6.math.trunc":"tiOR","core-js/modules/es6.number.constructor":"kRGG","core-js/modules/es6.number.epsilon":"DzYy","core-js/modules/es6.number.is-finite":"FuY7","core-js/modules/es6.number.is-integer":"pwRL","core-js/modules/es6.number.is-nan":"SsgJ","core-js/modules/es6.number.is-safe-integer":"qVIE","core-js/modules/es6.number.max-safe-integer":"shx2","core-js/modules/es6.number.min-safe-integer":"ifBH","core-js/modules/es6.number.parse-float":"yjyf","core-js/modules/es6.number.parse-int":"Guno","core-js/modules/es6.object.assign":"K3Jy","core-js/modules/es7.object.define-getter":"guoQ","core-js/modules/es7.object.define-setter":"HMp9","core-js/modules/es7.object.entries":"gxEP","core-js/modules/es6.object.freeze":"EO7q","core-js/modules/es6.object.get-own-property-descriptor":"nIty","core-js/modules/es7.object.get-own-property-descriptors":"BQD8","core-js/modules/es6.object.get-own-property-names":"i23Y","core-js/modules/es6.object.get-prototype-of":"ud3u","core-js/modules/es7.object.lookup-getter":"HB2g","core-js/modules/es7.object.lookup-setter":"QF5J","core-js/modules/es6.object.prevent-extensions":"llMc","core-js/modules/es6.object.to-string":"zTK3","core-js/modules/es6.object.is":"MlqR","core-js/modules/es6.object.is-frozen":"Z1rp","core-js/modules/es6.object.is-sealed":"Fckj","core-js/modules/es6.object.is-extensible":"EYbC","core-js/modules/es6.object.keys":"m9aB","core-js/modules/es6.object.seal":"GYFR","core-js/modules/es6.object.set-prototype-of":"JGjq","core-js/modules/es7.object.values":"Ltmz","core-js/modules/es6.promise":"Pjta","core-js/modules/es7.promise.finally":"l1j0","core-js/modules/es6.reflect.apply":"F0Xu","core-js/modules/es6.reflect.construct":"JlFO","core-js/modules/es6.reflect.define-property":"S841","core-js/modules/es6.reflect.delete-property":"JRlJ","core-js/modules/es6.reflect.get":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor":"zj1X","core-js/modules/es6.reflect.get-prototype-of":"d0aC","core-js/modules/es6.reflect.has":"OWTq","core-js/modules/es6.reflect.is-extensible":"deHu","core-js/modules/es6.reflect.own-keys":"e6SV","core-js/modules/es6.reflect.prevent-extensions":"BmyK","core-js/modules/es6.reflect.set":"K46i","core-js/modules/es6.reflect.set-prototype-of":"L5z5","core-js/modules/es6.regexp.constructor":"BenF","core-js/modules/es6.regexp.flags":"pDhD","core-js/modules/es6.regexp.match":"RTfC","core-js/modules/es6.regexp.replace":"KGao","core-js/modules/es6.regexp.split":"aOHf","core-js/modules/es6.regexp.search":"zOab","core-js/modules/es6.regexp.to-string":"iflU","core-js/modules/es6.set":"coyu","core-js/modules/es6.symbol":"uVn9","core-js/modules/es7.symbol.async-iterator":"DlMC","core-js/modules/es6.string.anchor":"USd7","core-js/modules/es6.string.big":"c1D0","core-js/modules/es6.string.blink":"Ee86","core-js/modules/es6.string.bold":"ry39","core-js/modules/es6.string.code-point-at":"zR9y","core-js/modules/es6.string.ends-with":"zRn7","core-js/modules/es6.string.fixed":"AHLq","core-js/modules/es6.string.fontcolor":"H7V0","core-js/modules/es6.string.fontsize":"Dx83","core-js/modules/es6.string.from-code-point":"xSM3","core-js/modules/es6.string.includes":"fH7p","core-js/modules/es6.string.italics":"fRhg","core-js/modules/es6.string.iterator":"tbKg","core-js/modules/es6.string.link":"Aaz0","core-js/modules/es7.string.pad-start":"SWNE","core-js/modules/es7.string.pad-end":"n20m","core-js/modules/es6.string.raw":"t29D","core-js/modules/es6.string.repeat":"C85R","core-js/modules/es6.string.small":"qBr3","core-js/modules/es6.string.starts-with":"w2SA","core-js/modules/es6.string.strike":"eNyu","core-js/modules/es6.string.sub":"BVLK","core-js/modules/es6.string.sup":"kMsL","core-js/modules/es7.string.trim-left":"ppxd","core-js/modules/es7.string.trim-right":"hxx1","core-js/modules/es6.typed.array-buffer":"NJ0a","core-js/modules/es6.typed.int8-array":"wqMZ","core-js/modules/es6.typed.uint8-array":"QTtY","core-js/modules/es6.typed.uint8-clamped-array":"Kqgs","core-js/modules/es6.typed.int16-array":"fEGw","core-js/modules/es6.typed.uint16-array":"xyd6","core-js/modules/es6.typed.int32-array":"hIko","core-js/modules/es6.typed.uint32-array":"tNPN","core-js/modules/es6.typed.float32-array":"wisA","core-js/modules/es6.typed.float64-array":"mbTX","core-js/modules/es6.weak-map":"D6DP","core-js/modules/es6.weak-set":"bRUR","core-js/modules/web.timers":"OTsy","core-js/modules/web.immediate":"hZLH","core-js/modules/web.dom.iterable":"v6Aj","regenerator-runtime/runtime":"QVnC","stats.js/src/Stats":"RDO9","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","../src/index.js":"uBxZ"}]},{},["ODOB"], null) \ No newline at end of file diff --git a/example/bundle/selection.383a520f.js b/example/bundle/selection.383a520f.js index 258a79102..4b63e86ac 100644 --- a/example/bundle/selection.383a520f.js +++ b/example/bundle/selection.383a520f.js @@ -30,9 +30,9 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;w?(m=e+8,T=v[e+6]):(m=v[e+6],T=e+8);var b=c(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[h];if(w?A<=o[T+B]:A>=o[T+B+3])return b}var M=c(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var v=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,v=3*(r+e);p3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,w=g,b=d,A=y;if(65535===b[B+15]&&l){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,v,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,h(S,w,q=c),h(z,w,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===c&&(v.boundingBox||v.computeBoundingBox(),l.set(v.boundingBox.min,v.boundingBox.max,x),l.update(),c=l),!(65535===T[f+15])){var w=t+8,b=B[t+6];return h(w,m,o),c.intersectsBox(o)&&e(w,i,v,x,c)?!0:(h(b,m,o),!(!c.intersectsBox(o)||!e(b,i,v,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=v.index,q=v.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(x).invert(),v.boundsTree){h(t,m,p),p.matrix.copy(u),p.update(),s.geometry=v;var N=v.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!1,s=u(this._roots);try{for(s.s();!(r=s.n()).done;){var l=r.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,n,i))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r contained ); + let result = false; for ( const root of this._roots ) { diff --git a/umd/index.js.map b/umd/index.js.map index 479124390..1c6ad6c47 100644 --- a/umd/index.js.map +++ b/umd/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// if the geometry doesn't have a bounding box, then let's politely populate it using\r\n\t// the work we did to determine the BVH root bounds\r\n\tif ( geo.boundingBox == null ) {\r\n\r\n\t\tconst rootBox = new Box3();\r\n\t\tgeo.boundingBox = new Box3();\r\n\r\n\t\tfor ( let root of roots ) {\r\n\r\n\t\t\tgeo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast( nodeIndex32,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc = null,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf && intersectsTriangleFunc ) {\r\n\r\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! geometry.boundingBox ) {\r\n\r\n\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( geometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n","import { Vector3, BufferAttribute } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geo, options = {} ) {\r\n\r\n\t\tif ( ! geo.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geo.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geo.index && geo.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geo, options );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\trefit( geometry ) {\r\n\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t_traverse( 0 );\r\n\r\n\t\t}\n\r\n\t\tfunction _traverse( node32Index ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\tconst leftChange = _traverse( left );\r\n\t\t\t\tconst rightChange = _traverse( right );\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, raycaster, ray );\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, geometry, geomToMesh ) {\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, geomToMesh );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! geom.boundingBox ) {\r\n\r\n\t\t\tgeom.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = geom.attributes.position;\r\n\t\tconst index = geom.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","xyzFields","arrayToBox","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YA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AExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// if the geometry doesn't have a bounding box, then let's politely populate it using\r\n\t// the work we did to determine the BVH root bounds\r\n\tif ( geo.boundingBox == null ) {\r\n\r\n\t\tconst rootBox = new Box3();\r\n\t\tgeo.boundingBox = new Box3();\r\n\r\n\t\tfor ( let root of roots ) {\r\n\r\n\t\t\tgeo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! geometry.boundingBox ) {\r\n\r\n\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( geometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n","import { Vector3, BufferAttribute } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geo, options = {} ) {\r\n\r\n\t\tif ( ! geo.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geo.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geo.index && geo.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geo, options );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\trefit( geometry ) {\r\n\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t_traverse( 0 );\r\n\r\n\t\t}\r\n\r\n\t\tfunction _traverse( node32Index ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\tconst leftChange = _traverse( left );\r\n\t\t\t\tconst rightChange = _traverse( right );\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, raycaster, ray );\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, geometry, geomToMesh ) {\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, geomToMesh );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\t// default the triangle intersection function\r\n\t\tintersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained );\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! geom.boundingBox ) {\r\n\r\n\t\t\tgeom.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = geom.attributes.position;\r\n\t\tconst index = geom.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","xyzFields","arrayToBox","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GA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AC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file From 1ef789e865742daade5e8a3c5e928c623a4e718e Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 21:32:16 -0800 Subject: [PATCH 083/139] add necessary quotes to lgtm.yml --- lgtm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgtm.yml b/lgtm.yml index b1022d86b..52f773a25 100644 --- a/lgtm.yml +++ b/lgtm.yml @@ -1,3 +1,3 @@ path_classifiers: template: - - src/*.template.js + - "src/*.template.js" From 2e4bf9ff1739184c801177c372f69d8f2e29e9d3 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 7 Mar 2021 21:58:30 -0800 Subject: [PATCH 084/139] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9695acb76..241119654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - `MeshBVHVisualizer` not using the new geometry BVH if one was generated. - `MeshBVHVisualizer` not using the new mesh if it was set. +- Case where passing in null `intersectsTriangleFunc` to `MeshBVH.shapecast` could throw an error. ## [0.3.7] - 2021-03-06 ### Fixed From f70c32869aa7ce7f5291f1cf40092e08b93104f6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 07:18:49 -0800 Subject: [PATCH 085/139] retain buffer references --- example/sculpt.js | 2 +- src/MeshBVH.js | 43 +++++++++++++++++++++-------------- src/castFunctions.js | 37 +++++++++++++++--------------- src/castFunctions.template.js | 37 +++++++++++++++--------------- 4 files changed, 65 insertions(+), 54 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 9d5b4bab2..55a946bc0 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -636,7 +636,7 @@ function render() { // so it's up to date for the next one because both of those are used when updating // the model but it's faster to do them here. updateNormals( changedTriangles, changedIndices ); - targetMesh.geometry.boundsTree.refit( targetMesh.geometry ); + targetMesh.geometry.boundsTree.refit(); bvhHelper.update(); } else { diff --git a/src/MeshBVH.js b/src/MeshBVH.js index e3577ba75..b0880ba4a 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -63,17 +63,17 @@ export default class MeshBVH { } - constructor( geo, options = {} ) { + constructor( geometry, options = {} ) { - if ( ! geo.isBufferGeometry ) { + if ( ! geometry.isBufferGeometry ) { throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); - } else if ( geo.attributes.position.isInterleavedBufferAttribute ) { + } else if ( geometry.attributes.position.isInterleavedBufferAttribute ) { throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); - } else if ( geo.index && geo.index.isInterleavedBufferAttribute ) { + } else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) { throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); @@ -98,14 +98,19 @@ export default class MeshBVH { this._roots = null; if ( ! options[ SKIP_GENERATION ] ) { - this._roots = buildPackedTree( geo, options ); + this._roots = buildPackedTree( geometry, options ); } + // retain references to the geometry so we can use them it without having to + // take a geometry reference in every function. + this.geometry = geometry; + } - refit( geometry ) { + refit() { + const geometry = this.geometry; const indexArr = geometry.index.array; const posArr = geometry.attributes.position.array; let buffer, uint32Array, uint16Array, float32Array; @@ -254,10 +259,11 @@ export default class MeshBVH { /* Core Cast Functions */ raycast( mesh, raycaster, ray, intersects ) { + const geometry = this.geometry; for ( const root of this._roots ) { setBuffer( root ); - raycast( 0, mesh, raycaster, ray, intersects ); + raycast( 0, mesh, geometry, raycaster, ray, intersects ); } @@ -267,11 +273,12 @@ export default class MeshBVH { raycastFirst( mesh, raycaster, ray ) { + const geometry = this.geometry; let closestResult = null; for ( const root of this._roots ) { setBuffer( root ); - const result = raycastFirst( 0, mesh, raycaster, ray ); + const result = raycastFirst( 0, mesh, geometry, raycaster, ray ); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -287,13 +294,14 @@ export default class MeshBVH { } - intersectsGeometry( mesh, geometry, geomToMesh ) { + intersectsGeometry( mesh, otherGeometry, geomToMesh ) { + const geometry = this.geometry; let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = intersectsGeometry( 0, mesh, geometry, geomToMesh ); + result = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh ); if ( result ) { @@ -314,11 +322,12 @@ export default class MeshBVH { // default the triangle intersection function intersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained ); + const geometry = this.geometry; let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); + result = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); if ( result ) { @@ -358,19 +367,19 @@ export default class MeshBVH { } - closestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { + closestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { - if ( ! geom.boundingBox ) { + if ( ! otherGeometry.boundingBox ) { - geom.computeBoundingBox(); + otherGeometry.computeBoundingBox(); } - obb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh ); + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); obb.update(); - const pos = geom.attributes.position; - const index = geom.index; + const pos = otherGeometry.attributes.position; + const index = otherGeometry.index; let tempTarget1 = null; let tempTarget2 = null; diff --git a/src/castFunctions.js b/src/castFunctions.js index 70e25f059..61829fa4e 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -14,7 +14,7 @@ const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { +export function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -24,7 +24,7 @@ export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { const offset = uint32Array[ nodeIndex32 + 6 ]; const count = uint16Array[ nodeIndex16 + 14 ]; - intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); + intersectTris( mesh, geometry, raycaster, ray, offset, count, intersects ); } else { @@ -46,7 +46,7 @@ export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { } -export function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { +export function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -55,7 +55,7 @@ export function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { const offset = uint32Array[ nodeIndex32 + 6 ]; const count = uint16Array[ nodeIndex16 + 14 ]; - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); + return intersectClosestTri( mesh, geometry, raycaster, ray, offset, count ); } else { @@ -158,6 +158,7 @@ export const shapecast = ( function () { return function shapecast( nodeIndex32, mesh, + geometry, intersectsBoundsFunc, intersectsTriangleFunc, nodeScoreFunc = null, @@ -208,7 +209,6 @@ export const shapecast = ( function () { const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - const geometry = mesh.geometry; const offset = uint32Array[ nodeIndex32 + 6 ]; const count = uint16Array[ nodeIndex16 + 14 ]; return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); @@ -264,7 +264,6 @@ export const shapecast = ( function () { let c1StopTraversal; if ( c1Intersection === CONTAINED ) { - const geometry = mesh.geometry; const offset = getLeftOffset( c1 ); const end = getRightEndOffset( c1 ); const count = end - offset; @@ -278,6 +277,7 @@ export const shapecast = ( function () { shapecast( c1, mesh, + geometry, intersectsBoundsFunc, intersectsTriangleFunc, nodeScoreFunc, @@ -316,6 +316,7 @@ export const shapecast = ( function () { shapecast( c2, mesh, + geometry, intersectsBoundsFunc, intersectsTriangleFunc, nodeScoreFunc, @@ -347,19 +348,19 @@ export const intersectsGeometry = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { + return function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; if ( cachedObb === null ) { - if ( ! geometry.boundingBox ) { + if ( ! otherGeometry.boundingBox ) { - geometry.computeBoundingBox(); + otherGeometry.computeBoundingBox(); } - obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); obb.update(); cachedObb = obb; @@ -368,12 +369,12 @@ export const intersectsGeometry = ( function () { const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - const thisGeometry = mesh.geometry; + const thisGeometry = geometry; const thisIndex = thisGeometry.index; const thisPos = thisGeometry.attributes.position; - const index = geometry.index; - const pos = geometry.attributes.position; + const index = otherGeometry.index; + const pos = otherGeometry.attributes.position; const offset = uint32Array[ nodeIndex32 + 6 ]; const count = uint16Array[ nodeIndex16 + 14 ]; @@ -383,14 +384,14 @@ export const intersectsGeometry = ( function () { // here. invertedMat.copy( geometryToBvh ).invert(); - if ( geometry.boundsTree ) { + if ( otherGeometry.boundsTree ) { arrayToBox( nodeIndex32, float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); - cachedMesh.geometry = geometry; - const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + cachedMesh.geometry = otherGeometry; + const res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { tri.a.applyMatrix4( geometryToBvh ); tri.b.applyMatrix4( geometryToBvh ); @@ -453,14 +454,14 @@ export const intersectsGeometry = ( function () { arrayToBox( left, float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; arrayToBox( right, float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( rightIntersection ) return true; diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 860ef9333..4b177ab1a 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -16,7 +16,7 @@ const boundingBox = new Box3(); const boxIntersection = new Vector3(); const xyzFields = [ 'x', 'y', 'z' ]; -export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { +export function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -26,7 +26,7 @@ export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { const offset = OFFSET( nodeIndex32 ); const count = COUNT( nodeIndex16 ); - intersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects ); + intersectTris( mesh, geometry, raycaster, ray, offset, count, intersects ); } else { @@ -48,7 +48,7 @@ export function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) { } -export function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { +export function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; @@ -57,7 +57,7 @@ export function raycastFirst( nodeIndex32, mesh, raycaster, ray ) { const offset = OFFSET( nodeIndex32 ); const count = COUNT( nodeIndex16 ); - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count ); + return intersectClosestTri( mesh, geometry, raycaster, ray, offset, count ); } else { @@ -160,6 +160,7 @@ export const shapecast = ( function () { return function shapecast( nodeIndex32, mesh, + geometry, intersectsBoundsFunc, intersectsTriangleFunc, nodeScoreFunc = null, @@ -210,7 +211,6 @@ export const shapecast = ( function () { const isLeaf = IS_LEAF( nodeIndex16 ); if ( isLeaf ) { - const geometry = mesh.geometry; const offset = OFFSET( nodeIndex32 ); const count = COUNT( nodeIndex16 ); return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); @@ -266,7 +266,6 @@ export const shapecast = ( function () { let c1StopTraversal; if ( c1Intersection === CONTAINED ) { - const geometry = mesh.geometry; const offset = getLeftOffset( c1 ); const end = getRightEndOffset( c1 ); const count = end - offset; @@ -280,6 +279,7 @@ export const shapecast = ( function () { shapecast( c1, mesh, + geometry, intersectsBoundsFunc, intersectsTriangleFunc, nodeScoreFunc, @@ -318,6 +318,7 @@ export const shapecast = ( function () { shapecast( c2, mesh, + geometry, intersectsBoundsFunc, intersectsTriangleFunc, nodeScoreFunc, @@ -349,19 +350,19 @@ export const intersectsGeometry = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) { + return function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) { let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; if ( cachedObb === null ) { - if ( ! geometry.boundingBox ) { + if ( ! otherGeometry.boundingBox ) { - geometry.computeBoundingBox(); + otherGeometry.computeBoundingBox(); } - obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); obb.update(); cachedObb = obb; @@ -370,12 +371,12 @@ export const intersectsGeometry = ( function () { const isLeaf = IS_LEAF( nodeIndex16 ); if ( isLeaf ) { - const thisGeometry = mesh.geometry; + const thisGeometry = geometry; const thisIndex = thisGeometry.index; const thisPos = thisGeometry.attributes.position; - const index = geometry.index; - const pos = geometry.attributes.position; + const index = otherGeometry.index; + const pos = otherGeometry.attributes.position; const offset = OFFSET( nodeIndex32 ); const count = COUNT( nodeIndex16 ); @@ -385,14 +386,14 @@ export const intersectsGeometry = ( function () { // here. invertedMat.copy( geometryToBvh ).invert(); - if ( geometry.boundsTree ) { + if ( otherGeometry.boundsTree ) { arrayToBox( BOUNDING_DATA_INDEX( nodeIndex32 ), float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); - cachedMesh.geometry = geometry; - const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + cachedMesh.geometry = otherGeometry; + const res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { tri.a.applyMatrix4( geometryToBvh ); tri.b.applyMatrix4( geometryToBvh ); @@ -455,14 +456,14 @@ export const intersectsGeometry = ( function () { arrayToBox( BOUNDING_DATA_INDEX( left ), float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; arrayToBox( BOUNDING_DATA_INDEX( right ), float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( rightIntersection ) return true; From 1beea650fb1a1d44fb1792302f641407db1ae0eb Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 07:25:20 -0800 Subject: [PATCH 086/139] Fix all cast functions --- src/castFunctions.js | 8 ++++---- src/castFunctions.template.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/castFunctions.js b/src/castFunctions.js index 61829fa4e..9e92839af 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -31,14 +31,14 @@ export function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects const leftIndex = nodeIndex32 + 8; if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { - raycast( leftIndex, mesh, raycaster, ray, intersects ); + raycast( leftIndex, mesh, geometry, raycaster, ray, intersects ); } const rightIndex = uint32Array[ nodeIndex32 + 6 ]; if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { - raycast( rightIndex, mesh, raycaster, ray, intersects ); + raycast( rightIndex, mesh, geometry, raycaster, ray, intersects ); } @@ -81,7 +81,7 @@ export function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { } const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); - const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; + const c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null; // if we got an intersection in the first node and it's closer than the second node's bounding // box, we don't need to consider the second node because it couldn't possibly be a better result @@ -104,7 +104,7 @@ export function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { // either there was no intersection in the first node, or there could still be a closer // intersection in the second, so check the second node and then take the better of the two const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); - const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; + const c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null; if ( c1Result && c2Result ) { diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 4b177ab1a..fb7954ef8 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -33,14 +33,14 @@ export function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects const leftIndex = LEFT_NODE( nodeIndex32 ); if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { - raycast( leftIndex, mesh, raycaster, ray, intersects ); + raycast( leftIndex, mesh, geometry, raycaster, ray, intersects ); } const rightIndex = RIGHT_NODE( nodeIndex32 ); if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { - raycast( rightIndex, mesh, raycaster, ray, intersects ); + raycast( rightIndex, mesh, geometry, raycaster, ray, intersects ); } @@ -83,7 +83,7 @@ export function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { } const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); - const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; + const c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null; // if we got an intersection in the first node and it's closer than the second node's bounding // box, we don't need to consider the second node because it couldn't possibly be a better result @@ -106,7 +106,7 @@ export function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { // either there was no intersection in the first node, or there could still be a closer // intersection in the second, so check the second node and then take the better of the two const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); - const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; + const c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null; if ( c1Result && c2Result ) { From cb142e591e40c025155e968c9e2360362441bf7f Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 07:26:53 -0800 Subject: [PATCH 087/139] README update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d477b770b..ac2debf10 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ _NOTE: The returned MeshBVH is a fully generated, buffer packed BVH instance to constructor( geometry : BufferGeometry, options : Object ) ``` -Constructs the bounds tree for the given geometry and produces a new index attribute buffer. The available options are +Constructs the bounds tree for the given geometry and produces a new index attribute buffer. A reference to the passed geometry is retained. The available options are ```js { From cf6564be3ce901c96ae31e4242f6d949aab3b02b Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 07:55:17 -0800 Subject: [PATCH 088/139] Update comments --- example/sculpt.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/example/sculpt.js b/example/sculpt.js index 55a946bc0..896c250b3 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -193,6 +193,9 @@ function init() { gui.add( { reset }, 'reset' ); gui.add( { rebuildBVH: () => { + // dispose of the bounding box because it's used in BVH construction but + // will be out of date here. See issue #222. + targetMesh.geometry.boundingBox = null; targetMesh.geometry.computeBoundsTree(); bvhHelper.update(); From 146759853c6a79855f0c68e6cafb6ece97ab50db Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 08:14:21 -0800 Subject: [PATCH 089/139] Add bounding box benchmark --- benchmark/run-benchmark.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index 31c1fdfa5..9f8a086bc 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -48,15 +48,38 @@ function runSuite( strategy ) { geometry.computeBoundsTree( options ); logExtremes( geometry.boundsTree, geometry ); + geometry.computeBoundingBox(); runBenchmark( - 'Compute BVH', - null, + 'Compute BVH w/ BB', + () => { + + geometry.boundsTree = null; + + }, () => { geometry.computeBoundsTree( options ); + + }, + 3000, + 50 + + ); + + runBenchmark( + + 'Compute BVH w/o BB', + () => { + + geometry.boundingBox = null; geometry.boundsTree = null; + }, + () => { + + geometry.computeBoundsTree( options ); + }, 3000, 50 From 62bd707c2c44bacdb1c0cb261492465c400c55b8 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 16:21:27 -0800 Subject: [PATCH 090/139] Add getBoundingBox function --- src/MeshBVH.js | 29 ++++++++++++++++++++++++++++- src/buildFunctions.js | 15 --------------- src/castFunctions.template.js | 13 +------------ 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index b0880ba4a..a3b7a2ae9 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -1,4 +1,4 @@ -import { Vector3, BufferAttribute } from 'three'; +import { Vector3, BufferAttribute, Box3 } from 'three'; import { CENTER } from './Constants.js'; import { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js'; import { OrientedBox } from './Utils/OrientedBox.js'; @@ -12,6 +12,7 @@ import { setBuffer, clearBuffer, } from './castFunctions.js'; +import { arrayToBox } from './Utils/BufferNodeUtils.js'; const SKIP_GENERATION = Symbol( 'skip tree generation' ); @@ -20,6 +21,8 @@ const temp = new Vector3(); const tri2 = new SeparatingAxisTriangle(); const temp1 = new Vector3(); const temp2 = new Vector3(); +const tempBox1 = new Box3(); +const tempBox2 = new Box3(); export default class MeshBVH { @@ -87,6 +90,8 @@ export default class MeshBVH { maxLeafTris: 10, verbose: true, + setBoundingBox: true, + // undocumented options // Whether to skip generating the tree. Used for deserialization. @@ -100,6 +105,12 @@ export default class MeshBVH { this._roots = buildPackedTree( geometry, options ); + if ( ! geometry.boundingBox && options.setBoundingBox ) { + + geometry.boundingBox = this.getBoundingBox( new Box3() ); + + } + } // retain references to the geometry so we can use them it without having to @@ -523,4 +534,20 @@ export default class MeshBVH { } + getBoundingBox( target ) { + + target.empty(); + + const roots = this._roots; + roots.forEach( buffer => { + + arrayToBox( 0, new Float32Array( buffer ), tempBox1 ); + target.union( tempBox1 ); + + } ); + + return target; + + } + } diff --git a/src/buildFunctions.js b/src/buildFunctions.js index 08ba03b3c..fc8979521 100644 --- a/src/buildFunctions.js +++ b/src/buildFunctions.js @@ -623,21 +623,6 @@ export function buildTree( geo, options ) { } - // if the geometry doesn't have a bounding box, then let's politely populate it using - // the work we did to determine the BVH root bounds - if ( geo.boundingBox == null ) { - - const rootBox = new Box3(); - geo.boundingBox = new Box3(); - - for ( let root of roots ) { - - geo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) ); - - } - - } - return roots; } diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index fb7954ef8..c657184ca 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -6,6 +6,7 @@ // with inline buffer reads. See generate-cast-functions.js. import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; +import { arrayToBox } from './Utils/BufferNodeUtils.js'; import { OrientedBox } from './Utils/OrientedBox.js'; import { setTriangle } from './Utils/TriangleUtils.js'; @@ -516,15 +517,3 @@ export function clearBuffer() { } } - -function arrayToBox( nodeIndex32, array, target ) { - - target.min.x = array[ nodeIndex32 ]; - target.min.y = array[ nodeIndex32 + 1 ]; - target.min.z = array[ nodeIndex32 + 2 ]; - - target.max.x = array[ nodeIndex32 + 3 ]; - target.max.y = array[ nodeIndex32 + 4 ]; - target.max.z = array[ nodeIndex32 + 5 ]; - -} From d12e1f50062cea4a85726c54970f27ddb053008d Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 16:26:08 -0800 Subject: [PATCH 091/139] Create the bounding box from MeshBVH Worker --- src/workers/GenerateMeshBVHWorker.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/workers/GenerateMeshBVHWorker.js b/src/workers/GenerateMeshBVHWorker.js index aba16e663..60593caa7 100644 --- a/src/workers/GenerateMeshBVHWorker.js +++ b/src/workers/GenerateMeshBVHWorker.js @@ -1,3 +1,4 @@ +import { Box3 } from 'three'; import MeshBVH from '../MeshBVH.js'; export class GenerateMeshBVHWorker { @@ -35,6 +36,11 @@ export class GenerateMeshBVHWorker { } else { const bvh = MeshBVH.deserialize( serialized, geometry, false ); + const boundsOptions = Object.assign( { + + setBoundingBox: true, + + }, options ); // we need to replace the arrays because they're neutered entirely by the // webworker transfer. @@ -45,6 +51,12 @@ export class GenerateMeshBVHWorker { } + if ( boundsOptions.setBoundingBox ) { + + geometry.boundingBox = bvh.getBoundingBox( new Box3() ); + + } + resolve( bvh ); } From efd2b4dd31afa037b48dc3626fe7aef5d7c45caa Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 19:39:52 -0800 Subject: [PATCH 092/139] CHANGELOG, README update, benchmark update --- CHANGELOG.md | 2 ++ README.md | 14 +++++++++++++- benchmark/run-benchmark.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 241119654..1119eab2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased ### Added - `MeshBVH.refit` function to refit the bounds to modified vertices. +- `setBoundingBox` MeshBVH construction option. +- `MeshBVH.getBoundingBox` function. ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. diff --git a/README.md b/README.md index ac2debf10..28e811f96 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,10 @@ Constructs the bounds tree for the given geometry and produces a new index attri // The number of triangles to aim for in a leaf node. maxLeafTris: 10, + // If true then the bounding box for the geometry is set once the BVH + // has been constructed. + setBoundingBox: true, + // Print out warnings encountered during tree construction. verbose: true, @@ -360,7 +364,15 @@ A generalized cast function that can be used to implement intersection logic for refit( geometry : BufferGeometry ) : void ``` -Refit the node bounds to the current triangle positions. This is quicker than regenerating a new BVH but will not be optimal after significant changes to the vertice. +Refit the node bounds to the current triangle positions. This is quicker than regenerating a new BVH but will not be optimal after significant changes to the vertices. + +### .getBoundingBox + +```js +getBoundingBox( target : Box3 ) : Box3 +``` + +Get the bounding box of the geometry computed from the root node bounds of the BVH. Significantly faster than `BufferGeometry.computeBoundingBox`. ## SerializedBVH diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index 9f8a086bc..4d1ef06d1 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -86,6 +86,34 @@ function runSuite( strategy ) { ); + const tempBox = new THREE.Box3(); + runBenchmark( + + 'Compute BB w/ BVH', + null, + () => { + + geometry.boundsTree.getBoundingBox( tempBox ); + + }, + 3000, + 50 + + ); + + runBenchmark( + + 'Compute BB w/o BVH', + null, + () => { + + geometry.computeBoundingBox(); + + }, + 3000, + 50 + + ); geometry.computeBoundsTree( options ); runBenchmark( From 4fe248cdd694fe1ecb578582b6dee7a9f719ddbc Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 19:43:46 -0800 Subject: [PATCH 093/139] Add tests, update castFunctions --- src/MeshBVH.js | 2 +- src/castFunctions.js | 13 +------------ test/MeshBVH.test.js | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index a3b7a2ae9..9a6932bf7 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -536,7 +536,7 @@ export default class MeshBVH { getBoundingBox( target ) { - target.empty(); + target.makeEmpty(); const roots = this._roots; roots.forEach( buffer => { diff --git a/src/castFunctions.js b/src/castFunctions.js index 9e92839af..7785a59db 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -4,6 +4,7 @@ // with inline buffer reads. See generate-cast-functions.js. import { Box3, Vector3, Mesh, Matrix4 } from 'three'; import { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js'; +import { arrayToBox } from './Utils/BufferNodeUtils.js'; import { OrientedBox } from './Utils/OrientedBox.js'; import { setTriangle } from './Utils/TriangleUtils.js'; @@ -514,15 +515,3 @@ export function clearBuffer() { } } - -function arrayToBox( nodeIndex32, array, target ) { - - target.min.x = array[ nodeIndex32 ]; - target.min.y = array[ nodeIndex32 + 1 ]; - target.min.z = array[ nodeIndex32 + 2 ]; - - target.max.x = array[ nodeIndex32 + 3 ]; - target.max.y = array[ nodeIndex32 + 4 ]; - target.max.z = array[ nodeIndex32 + 5 ]; - -} diff --git a/test/MeshBVH.test.js b/test/MeshBVH.test.js index 3bd5eb28e..4400fb973 100644 --- a/test/MeshBVH.test.js +++ b/test/MeshBVH.test.js @@ -250,6 +250,28 @@ describe( 'Options', () => { } ); + describe( 'setBoundingBox', () => { + + it( 'should set the bounding box of the geometry when true.', () => { + + mesh.geometry.boundingBox = null; + mesh.geometry.computeBoundsTree( { setBoundingBox: true } ); + + expect( mesh.geometry.boundingBox ).not.toBe( null ); + + } ); + + it( 'should not set the bounding box of the geometry when false.', () => { + + mesh.geometry.boundingBox = null; + mesh.geometry.computeBoundsTree( { setBoundingBox: false } ); + + expect( mesh.geometry.boundingBox ).toBe( null ); + + } ); + + } ); + describe( 'maxDepth', () => { it( 'should not be limited by default', () => { From 77f6c3e9a46f6724b680af9ccbaf18fb90112738 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 19:45:08 -0800 Subject: [PATCH 094/139] sculpt update --- example/sculpt.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 896c250b3..12903081c 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -68,7 +68,7 @@ function reset() { geometry = BufferGeometryUtils.mergeVertices( geometry ); geometry.attributes.position.setUsage( THREE.DynamicDrawUsage ); geometry.attributes.normal.setUsage( THREE.DynamicDrawUsage ); - geometry.computeBoundsTree(); + geometry.computeBoundsTree( { setBoundingBox: false } ); // disable frustum culling because the verts will be updated targetMesh = new THREE.Mesh( @@ -193,10 +193,9 @@ function init() { gui.add( { reset }, 'reset' ); gui.add( { rebuildBVH: () => { - // dispose of the bounding box because it's used in BVH construction but - // will be out of date here. See issue #222. - targetMesh.geometry.boundingBox = null; - targetMesh.geometry.computeBoundsTree(); + // don't create a bounding box because it's used in BVH construction but + // will be out of date after moving vertices. See issue #222. + targetMesh.geometry.computeBoundsTree( { setBoundingBox: false } ); bvhHelper.update(); } }, 'rebuildBVH' ); From 08b196c869af1143f930f175a65ff56440b708b9 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 19:57:05 -0800 Subject: [PATCH 095/139] README update --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 28e811f96..b6a578d30 100644 --- a/README.md +++ b/README.md @@ -225,9 +225,9 @@ Constructs the bounds tree for the given geometry and produces a new index attri // The number of triangles to aim for in a leaf node. maxLeafTris: 10, - // If true then the bounding box for the geometry is set once the BVH - // has been constructed. - setBoundingBox: true, + // If true then the bounding box for the geometry is set once the BVH + // has been constructed. + setBoundingBox: true, // Print out warnings encountered during tree construction. verbose: true, From 53af38a45d11ecd8f747192c674c16b0e2a76d05 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 19:58:00 -0800 Subject: [PATCH 096/139] benchmark spacing --- benchmark/run-benchmark.js | 1 + 1 file changed, 1 insertion(+) diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index 4d1ef06d1..659d5f898 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -114,6 +114,7 @@ function runSuite( strategy ) { 50 ); + geometry.computeBoundsTree( options ); runBenchmark( From b4f96dd4bb616dd66d2ffe3f13b6a5b9380a56af Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 20:00:26 -0800 Subject: [PATCH 097/139] fix variable naming --- src/MeshBVH.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 9a6932bf7..85a1fa23f 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -21,8 +21,7 @@ const temp = new Vector3(); const tri2 = new SeparatingAxisTriangle(); const temp1 = new Vector3(); const temp2 = new Vector3(); -const tempBox1 = new Box3(); -const tempBox2 = new Box3(); +const tempBox = new Box3(); export default class MeshBVH { @@ -541,8 +540,8 @@ export default class MeshBVH { const roots = this._roots; roots.forEach( buffer => { - arrayToBox( 0, new Float32Array( buffer ), tempBox1 ); - target.union( tempBox1 ); + arrayToBox( 0, new Float32Array( buffer ), tempBox ); + target.union( tempBox ); } ); From 925355d99ed3dff016c2ef9a8512c3fdb40e724e Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Tue, 9 Mar 2021 20:02:29 -0800 Subject: [PATCH 098/139] Add missing file --- src/Utils/BufferNodeUtils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/Utils/BufferNodeUtils.js diff --git a/src/Utils/BufferNodeUtils.js b/src/Utils/BufferNodeUtils.js new file mode 100644 index 000000000..e85f8c4fd --- /dev/null +++ b/src/Utils/BufferNodeUtils.js @@ -0,0 +1,11 @@ +export function arrayToBox( nodeIndex32, array, target ) { + + target.min.x = array[ nodeIndex32 ]; + target.min.y = array[ nodeIndex32 + 1 ]; + target.min.z = array[ nodeIndex32 + 2 ]; + + target.max.x = array[ nodeIndex32 + 3 ]; + target.max.y = array[ nodeIndex32 + 4 ]; + target.max.z = array[ nodeIndex32 + 5 ]; + +} From 7cc99031e71c6a31fb1bb878f06a4b9ceed2f171 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 10:15:14 -0800 Subject: [PATCH 099/139] build --- example/bundle/asyncGenerate.4a48c6e8.js | 18 ++- example/bundle/asyncGenerate.html | 3 +- example/bundle/characterMovement.725f956b.js | 14 +- example/bundle/collectTriangles.9c45819a.js | 14 +- example/bundle/collectTriangles.html | 3 +- example/bundle/distancecast.4107d8f2.js | 14 +- example/bundle/distancecast.html | 3 +- .../bundle/generateAsync.worker.13d14241.js | 14 +- example/bundle/physics.50b811f1.js | 14 +- example/bundle/randomSampleDebug.32ad2b43.js | 14 +- example/bundle/raycast.88074831.js | 14 +- example/bundle/raycast.html | 3 +- example/bundle/sculpt.493e9c78.js | 16 +- example/bundle/selection.383a520f.js | 14 +- example/bundle/shapecast.b93a7fe2.js | 14 +- umd/index.js | 152 ++++++++++-------- umd/index.js.map | 2 +- 17 files changed, 186 insertions(+), 140 deletions(-) diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index 7e860e9c9..abf786eaf 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -12,7 +12,7 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -27,13 +27,15 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var i=this.worker;return this.running=!0,new Promise(function(o,a){i.onmessage=function(t){n.running=!1,i.onmessage=null;var s=t.data,u=s.serialized,f=s.position,l=s.error;if(l)a(new Error(l));else{var d=e.default.deserialize(u,r,!1);r.attributes.position.array=f,r.index&&(r.index.array=u.index),o(d)}};var s=r.index?r.index.array:null,u=r.attributes.position.array;if(u.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var f=[u];s&&f.push(s),i.postMessage({index:s,position:u,options:t},f.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),r}();exports.GenerateMeshBVHWorker=o; -},{"../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { +},{"./ThreeIntersectionUtilities.js":"lzxM"}],"dxfM":[function(require,module,exports) { +"use strict";function e(e,x,o){o.min.x=x[e],o.min.y=x[e+1],o.min.z=x[e+2],o.max.x=x[e+3],o.max.y=x[e+4],o.max.z=x[e+5]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToBox=e; +},{}],"mmvR":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.raycast=x,exports.raycastFirst=p,exports.setBuffer=w,exports.clearBuffer=h,exports.intersectsGeometry=exports.shapecast=void 0;var r=require("three"),e=require("./Utils/RayIntersectTriUtlities.js"),t=require("./Utils/BufferNodeUtils.js"),n=require("./Utils/OrientedBox.js"),i=require("./Utils/TriangleUtils.js"),a=require("./Utils/SeparatingAxisTriangle.js"),o=require("./Constants.js"),s=new r.Box3,u=new r.Vector3,l=["x","y","z"];function x(r,t,n,i,a,o){var s=2*r,l=g,p=y,c=B;if(65535===p[s+15]){var v=c[r+6],d=p[s+14];(0,e.intersectTris)(t,n,i,a,v,d,o)}else{var T=r+8;f(T,l,a,u)&&x(T,t,n,i,a,o);var w=c[r+6];f(w,l,a,u)&&x(w,t,n,i,a,o)}}function p(r,t,n,i,a){var o=2*r,s=g,x=y,c=B;if(65535===x[o+15]){var v=c[r+6],d=x[o+14];return(0,e.intersectClosestTri)(t,n,i,a,v,d)}var T,w,h=c[r+7],b=l[h],U=a.direction[b]>=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var o=this.worker;return this.running=!0,new Promise(function(a,u){o.onmessage=function(s){t.running=!1,o.onmessage=null;var f=s.data,l=f.serialized,d=f.position,c=f.error;if(c)u(new Error(c));else{var h=r.default.deserialize(l,n,!1),g=Object.assign({setBoundingBox:!0},i);n.attributes.position.array=d,n.index&&(n.index.array=l.index),g.setBoundingBox&&(n.boundingBox=h.getBoundingBox(new e.Box3)),a(h)}};var s=n.index?n.index.array:null,f=n.attributes.position.array;if(f.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var l=[f];s&&l.push(s),o.postMessage({index:s,position:f,options:i},l.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),n}();exports.GenerateMeshBVHWorker=a; +},{"three":"dKqR","../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iTHREE.js BVH Geometry Collect Triangles
\ No newline at end of file +THREE.js BVH Geometry Collect Triangles
+ \ No newline at end of file diff --git a/example/bundle/characterMovement.725f956b.js b/example/bundle/characterMovement.725f956b.js index 1f77ed45f..a680b2b55 100644 --- a/example/bundle/characterMovement.725f956b.js +++ b/example/bundle/characterMovement.725f956b.js @@ -20,7 +20,7 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -35,11 +35,13 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -554,11 +554,13 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iTHREE.js BVH Geometry Collect Triangles \ No newline at end of file +THREE.js BVH Geometry Collect Triangles + \ No newline at end of file diff --git a/example/bundle/distancecast.4107d8f2.js b/example/bundle/distancecast.4107d8f2.js index 84e02652c..3e3b36fdc 100644 --- a/example/bundle/distancecast.4107d8f2.js +++ b/example/bundle/distancecast.4107d8f2.js @@ -545,7 +545,7 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{}],"qYFu":[function(require,module,exports) { "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=function t(){e(this,t)};exports.default=t; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -560,11 +560,13 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return rTHREE.js BVH Geometry Closest Distance
\ No newline at end of file +THREE.js BVH Geometry Closest Distance
+ \ No newline at end of file diff --git a/example/bundle/generateAsync.worker.13d14241.js b/example/bundle/generateAsync.worker.13d14241.js index 71a16420a..9fc13a509 100644 --- a/example/bundle/generateAsync.worker.13d14241.js +++ b/example/bundle/generateAsync.worker.13d14241.js @@ -7,7 +7,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -22,11 +22,13 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return rn&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -33,11 +33,13 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;in&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -22,11 +22,13 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -555,11 +555,13 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return rTHREE.js BVH Geometry Raycasting \ No newline at end of file +THREE.js BVH Geometry Raycasting + \ No newline at end of file diff --git a/example/bundle/sculpt.493e9c78.js b/example/bundle/sculpt.493e9c78.js index fc04905db..e6c3369fd 100644 --- a/example/bundle/sculpt.493e9c78.js +++ b/example/bundle/sculpt.493e9c78.js @@ -541,7 +541,7 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -556,11 +556,13 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Set,n=new l.Matrix4;n.copy(i.matrixWorld).invert();var u=new l.Sphere;u.center.copy(e).applyMatrix4(n),u.radius=z.size;var a=new Set,d=new l.Vector3,c=new l.Vector3,m=i.geometry.index,p=i.geometry.attributes.position,f=i.geometry.attributes.normal,q=new Set;i.geometry.boundsTree.shapecast(i,function(e){var r=u.intersectsBox(e),s=e.min,t=e.max;if(r){for(var o=0;o<=1;o++)for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)if(d.set(0===o?s.x:t.x,0===i?s.y:t.y,0===n?s.z:t.z),!u.containsPoint(d))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,i,n){var d=~~(r/3);q.add(d),t.add(d);var c=m.getX(r),l=m.getX(s),p=m.getX(i);return n?(a.add(c),a.add(l),a.add(p),o.add(c),o.add(l),o.add(p)):(u.containsPoint(e.a)&&(a.add(c),o.add(c)),u.containsPoint(e.b)&&(a.add(l),o.add(l)),u.containsPoint(e.c)&&(a.add(p),o.add(p))),!1});var y=new l.Vector3;y.copy(e).applyMatrix4(n);var g=new l.Vector3,w=0;if(a.forEach(function(e){d.fromBufferAttribute(f,e),c.add(d),s||(w++,d.fromBufferAttribute(p,e),g.add(d))}),c.normalize(),r.quaternion.setFromUnitVectors(h,c),w&&g.multiplyScalar(1/w),!s){var b=1e-4*z.intensity,v=new l.Plane;v.setFromNormalAndCoplanarPoint(c,g),a.forEach(function(e){d.fromBufferAttribute(p,e);var r=d.distanceTo(y),s=z.invert?-1:1,t=1-r/z.size;if("clay"===z.brush){t=Math.pow(t,3);var o=v.distanceToPoint(d),i=s*Math.min(4*t,1);d.addScaledVector(c,i*b-s*o*i*.3)}else if("normal"===z.brush)t=Math.pow(t,2),d.addScaledVector(c,s*t*b);else if("flatten"===z.brush){t=Math.pow(t,2);var n=v.distanceToPoint(d);d.addScaledVector(c,-n*t*z.intensity*.01*.5)}p.setXYZ(e,d.x,d.y,d.z),f.setXYZ(e,0,0,0)}),a.size&&(p.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active)n.visible=!1,M.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(w,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(z.size,z.size,.1),n.position.copy(c.point),u.visible=z.symmetrical,u.scale.set(z.size,z.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,M.x===1/0&&M.copy(c.point),v||x){for(var m=(w.x-b.x)*window.innerWidth*window.devicePixelRatio,p=(w.y-b.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(M),q=.15*z.size,y=Math.max(q/f,1/z.maxSteps),g=j*y,h=0,S=new Set,B=new Set;f>q&&j>200*z.size/c.distance&&(b.lerp(w,y),M.lerp(c.point,y),f-=q,j-=g,E(M,n,!1,S,B),z.symmetrical&&(M.x*=-1,E(M,u,!1,S,B),M.x*=-1),!(++h>z.maxSteps)););h>0?(P(S,B),i.geometry.boundsTree.refit(i.geometry),a.update()):(E(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1))}else E(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1),b.copy(w),M.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,b.copy(w),M.setScalar(1/0)}x=v,t.render(r,s),e.end()}B(),V(); +"use strict";require("core-js/modules/es6.array.copy-within"),require("core-js/modules/es6.array.fill"),require("core-js/modules/es6.array.find"),require("core-js/modules/es6.array.find-index"),require("core-js/modules/es7.array.flat-map"),require("core-js/modules/es6.array.from"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.array.iterator"),require("core-js/modules/es6.array.of"),require("core-js/modules/es6.array.sort"),require("core-js/modules/es6.array.species"),require("core-js/modules/es6.date.to-json"),require("core-js/modules/es6.date.to-primitive"),require("core-js/modules/es6.function.has-instance"),require("core-js/modules/es6.function.name"),require("core-js/modules/es6.map"),require("core-js/modules/es6.math.acosh"),require("core-js/modules/es6.math.asinh"),require("core-js/modules/es6.math.atanh"),require("core-js/modules/es6.math.cbrt"),require("core-js/modules/es6.math.clz32"),require("core-js/modules/es6.math.cosh"),require("core-js/modules/es6.math.expm1"),require("core-js/modules/es6.math.fround"),require("core-js/modules/es6.math.hypot"),require("core-js/modules/es6.math.imul"),require("core-js/modules/es6.math.log1p"),require("core-js/modules/es6.math.log10"),require("core-js/modules/es6.math.log2"),require("core-js/modules/es6.math.sign"),require("core-js/modules/es6.math.sinh"),require("core-js/modules/es6.math.tanh"),require("core-js/modules/es6.math.trunc"),require("core-js/modules/es6.number.constructor"),require("core-js/modules/es6.number.epsilon"),require("core-js/modules/es6.number.is-finite"),require("core-js/modules/es6.number.is-integer"),require("core-js/modules/es6.number.is-nan"),require("core-js/modules/es6.number.is-safe-integer"),require("core-js/modules/es6.number.max-safe-integer"),require("core-js/modules/es6.number.min-safe-integer"),require("core-js/modules/es6.number.parse-float"),require("core-js/modules/es6.number.parse-int"),require("core-js/modules/es6.object.assign"),require("core-js/modules/es7.object.define-getter"),require("core-js/modules/es7.object.define-setter"),require("core-js/modules/es7.object.entries"),require("core-js/modules/es6.object.freeze"),require("core-js/modules/es6.object.get-own-property-descriptor"),require("core-js/modules/es7.object.get-own-property-descriptors"),require("core-js/modules/es6.object.get-own-property-names"),require("core-js/modules/es6.object.get-prototype-of"),require("core-js/modules/es7.object.lookup-getter"),require("core-js/modules/es7.object.lookup-setter"),require("core-js/modules/es6.object.prevent-extensions"),require("core-js/modules/es6.object.to-string"),require("core-js/modules/es6.object.is"),require("core-js/modules/es6.object.is-frozen"),require("core-js/modules/es6.object.is-sealed"),require("core-js/modules/es6.object.is-extensible"),require("core-js/modules/es6.object.keys"),require("core-js/modules/es6.object.seal"),require("core-js/modules/es6.object.set-prototype-of"),require("core-js/modules/es7.object.values"),require("core-js/modules/es6.promise"),require("core-js/modules/es7.promise.finally"),require("core-js/modules/es6.reflect.apply"),require("core-js/modules/es6.reflect.construct"),require("core-js/modules/es6.reflect.define-property"),require("core-js/modules/es6.reflect.delete-property"),require("core-js/modules/es6.reflect.get"),require("core-js/modules/es6.reflect.get-own-property-descriptor"),require("core-js/modules/es6.reflect.get-prototype-of"),require("core-js/modules/es6.reflect.has"),require("core-js/modules/es6.reflect.is-extensible"),require("core-js/modules/es6.reflect.own-keys"),require("core-js/modules/es6.reflect.prevent-extensions"),require("core-js/modules/es6.reflect.set"),require("core-js/modules/es6.reflect.set-prototype-of"),require("core-js/modules/es6.regexp.constructor"),require("core-js/modules/es6.regexp.flags"),require("core-js/modules/es6.regexp.match"),require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es6.regexp.split"),require("core-js/modules/es6.regexp.search"),require("core-js/modules/es6.regexp.to-string"),require("core-js/modules/es6.set"),require("core-js/modules/es6.symbol"),require("core-js/modules/es7.symbol.async-iterator"),require("core-js/modules/es6.string.anchor"),require("core-js/modules/es6.string.big"),require("core-js/modules/es6.string.blink"),require("core-js/modules/es6.string.bold"),require("core-js/modules/es6.string.code-point-at"),require("core-js/modules/es6.string.ends-with"),require("core-js/modules/es6.string.fixed"),require("core-js/modules/es6.string.fontcolor"),require("core-js/modules/es6.string.fontsize"),require("core-js/modules/es6.string.from-code-point"),require("core-js/modules/es6.string.includes"),require("core-js/modules/es6.string.italics"),require("core-js/modules/es6.string.iterator"),require("core-js/modules/es6.string.link"),require("core-js/modules/es7.string.pad-start"),require("core-js/modules/es7.string.pad-end"),require("core-js/modules/es6.string.raw"),require("core-js/modules/es6.string.repeat"),require("core-js/modules/es6.string.small"),require("core-js/modules/es6.string.starts-with"),require("core-js/modules/es6.string.strike"),require("core-js/modules/es6.string.sub"),require("core-js/modules/es6.string.sup"),require("core-js/modules/es7.string.trim-left"),require("core-js/modules/es7.string.trim-right"),require("core-js/modules/es6.typed.array-buffer"),require("core-js/modules/es6.typed.int8-array"),require("core-js/modules/es6.typed.uint8-array"),require("core-js/modules/es6.typed.uint8-clamped-array"),require("core-js/modules/es6.typed.int16-array"),require("core-js/modules/es6.typed.uint16-array"),require("core-js/modules/es6.typed.int32-array"),require("core-js/modules/es6.typed.uint32-array"),require("core-js/modules/es6.typed.float32-array"),require("core-js/modules/es6.typed.float64-array"),require("core-js/modules/es6.weak-map"),require("core-js/modules/es6.weak-set"),require("core-js/modules/web.timers"),require("core-js/modules/web.immediate"),require("core-js/modules/web.dom.iterable"),require("regenerator-runtime/runtime");var e,r,s,t,o,i,n,u,a,d=y(require("stats.js/src/Stats")),c=q(require("dat.gui")),l=q(require("three")),m=require("three/examples/jsm/controls/OrbitControls.js"),p=require("three/examples/jsm/utils/BufferGeometryUtils.js"),j=require("../src/index.js");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function q(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=f();if(r&&r.has(e))return r.get(e);var s={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=t?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(s,o,i):s[o]=e[o]}return s.default=e,r&&r.set(e,s),s}function y(e){return e&&e.__esModule?e:{default:e}}l.Mesh.prototype.raycast=j.acceleratedRaycast,l.BufferGeometry.prototype.computeBoundsTree=j.computeBoundsTree,l.BufferGeometry.prototype.disposeBoundsTree=j.disposeBoundsTree;var g,h=new l.Vector3(0,0,1),w=new l.Vector2,b=new l.Vector2,v=!1,x=!1,B=new l.Vector3,M={size:.1,brush:"clay",intensity:50,maxSteps:10,invert:!1,symmetrical:!0,flatShading:!1,depth:10,displayHelper:!1};function z(){i&&(i.geometry.dispose(),i.material.dispose(),r.remove(i)),g||(g=(new l.TextureLoader).load("../textures/skinHazardousarts2.jpg"));var e=new l.IcosahedronBufferGeometry(1,100);e.deleteAttribute("uv"),(e=p.BufferGeometryUtils.mergeVertices(e)).attributes.position.setUsage(l.DynamicDrawUsage),e.attributes.normal.setUsage(l.DynamicDrawUsage),e.computeBoundsTree({setBoundingBox:!1}),(i=new l.Mesh(e,new l.MeshMatcapMaterial({flatShading:M.flatShading,matcap:g}))).material.matcap.encoding=l.sRGBEncoding,i.frustumCulled=!1,r.add(i),a||((a=new j.MeshBVHVisualizer(i,M.depth)).visible=M.displayHelper,r.add(a)),a.mesh=i,a.update()}function S(){(t=new l.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),t.setClearColor(1251612,1),t.gammaOutput=!0,document.body.appendChild(t.domElement),(r=new l.Scene).fog=new l.Fog(1251612,20,60);var p=new l.DirectionalLight(16777215,.5);p.position.set(1,1,1),r.add(p),r.add(new l.AmbientLight(16777215,.4)),z();for(var j=[new l.Vector3,new l.Vector3(0,0,1)],f=0;f<50;f++){var q=f+1,y=Math.sin(2*Math.PI*f/50),g=Math.cos(2*Math.PI*f/50),h=Math.sin(2*Math.PI*q/50),b=Math.cos(2*Math.PI*q/50);j.push(new l.Vector3(y,g,0),new l.Vector3(h,b,0))}(n=new l.LineSegments).geometry.setFromPoints(j),n.material.color.set(16485376),r.add(n),u=n.clone(),r.add(u),(s=new l.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,3),s.far=100,s.updateProjectionMatrix(),(o=new m.OrbitControls(s,t.domElement)).minDistance=1.5,e=new d.default,document.body.appendChild(e.dom);var x=new c.GUI,B=x.addFolder("Sculpting");B.add(M,"brush",["normal","clay","flatten"]),B.add(M,"size").min(.025).max(.25).step(.005),B.add(M,"intensity").min(1).max(100).step(1),B.add(M,"maxSteps").min(1).max(25).step(1),B.add(M,"symmetrical"),B.add(M,"invert"),B.add(M,"flatShading").onChange(function(e){i.material.flatShading=e,i.material.needsUpdate=!0}),B.open();var S=x.addFolder("BVH Helper");S.add(M,"depth").min(1).max(20).step(1).onChange(function(e){a.depth=parseFloat(e),a.update()}),S.add(M,"displayHelper").onChange(function(e){a.visible=e}),S.open(),x.add({reset:z},"reset"),x.add({rebuildBVH:function(){i.geometry.computeBoundsTree({setBoundingBox:!1}),a.update()}},"rebuildBVH"),x.open(),o.addEventListener("start",function(){this.active=!0}),o.addEventListener("end",function(){this.active=!1}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("mousemove",function(e){w.x=e.clientX/window.innerWidth*2-1,w.y=-e.clientY/window.innerHeight*2+1}),window.addEventListener("mousedown",function(e){v=Boolean(1&e.buttons)}),window.addEventListener("mouseup",function(e){v=Boolean(1&e.buttons)}),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),M.size+=1e-4*r,M.size=Math.max(Math.min(M.size,.25),.025),x.updateDisplay()})}function E(e,r){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Set,n=new l.Matrix4;n.copy(i.matrixWorld).invert();var u=new l.Sphere;u.center.copy(e).applyMatrix4(n),u.radius=M.size;var a=new Set,d=new l.Vector3,c=new l.Vector3,m=i.geometry.index,p=i.geometry.attributes.position,f=i.geometry.attributes.normal,q=new Set;i.geometry.boundsTree.shapecast(i,function(e){var r=u.intersectsBox(e),s=e.min,t=e.max;if(r){for(var o=0;o<=1;o++)for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)if(d.set(0===o?s.x:t.x,0===i?s.y:t.y,0===n?s.z:t.z),!u.containsPoint(d))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,i,n){var d=~~(r/3);q.add(d),t.add(d);var c=m.getX(r),l=m.getX(s),p=m.getX(i);return n?(a.add(c),a.add(l),a.add(p),o.add(c),o.add(l),o.add(p)):(u.containsPoint(e.a)&&(a.add(c),o.add(c)),u.containsPoint(e.b)&&(a.add(l),o.add(l)),u.containsPoint(e.c)&&(a.add(p),o.add(p))),!1});var y=new l.Vector3;y.copy(e).applyMatrix4(n);var g=new l.Vector3,w=0;if(a.forEach(function(e){d.fromBufferAttribute(f,e),c.add(d),s||(w++,d.fromBufferAttribute(p,e),g.add(d))}),c.normalize(),r.quaternion.setFromUnitVectors(h,c),w&&g.multiplyScalar(1/w),!s){var b=1e-4*M.intensity,v=new l.Plane;v.setFromNormalAndCoplanarPoint(c,g),a.forEach(function(e){d.fromBufferAttribute(p,e);var r=d.distanceTo(y),s=M.invert?-1:1,t=1-r/M.size;if("clay"===M.brush){t=Math.pow(t,3);var o=v.distanceToPoint(d),i=s*Math.min(4*t,1);d.addScaledVector(c,i*b-s*o*i*.3)}else if("normal"===M.brush)t=Math.pow(t,2),d.addScaledVector(c,s*t*b);else if("flatten"===M.brush){t=Math.pow(t,2);var n=v.distanceToPoint(d);d.addScaledVector(c,-n*t*M.intensity*.01*.5)}p.setXYZ(e,d.x,d.y,d.z),f.setXYZ(e,0,0,0)}),a.size&&(p.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active)n.visible=!1,B.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(w,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(M.size,M.size,.1),n.position.copy(c.point),u.visible=M.symmetrical,u.scale.set(M.size,M.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,B.x===1/0&&B.copy(c.point),v||x){for(var m=(w.x-b.x)*window.innerWidth*window.devicePixelRatio,p=(w.y-b.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(B),q=.15*M.size,y=Math.max(q/f,1/M.maxSteps),g=j*y,h=0,z=new Set,S=new Set;f>q&&j>200*M.size/c.distance&&(b.lerp(w,y),B.lerp(c.point,y),f-=q,j-=g,E(B,n,!1,z,S),M.symmetrical&&(B.x*=-1,E(B,u,!1,z,S),B.x*=-1),!(++h>M.maxSteps)););h>0?(P(z,S),i.geometry.boundsTree.refit(),a.update()):(E(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1))}else E(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1),b.copy(w),B.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,b.copy(w),B.setScalar(1/0)}x=v,t.render(r,s),e.end()}S(),V(); },{"core-js/modules/es6.array.copy-within":"tWTB","core-js/modules/es6.array.fill":"hUQ6","core-js/modules/es6.array.find":"Qppk","core-js/modules/es6.array.find-index":"sVmK","core-js/modules/es7.array.flat-map":"I8vV","core-js/modules/es6.array.from":"RRcs","core-js/modules/es7.array.includes":"TLss","core-js/modules/es6.array.iterator":"wVEN","core-js/modules/es6.array.of":"RB6b","core-js/modules/es6.array.sort":"nrVf","core-js/modules/es6.array.species":"smn3","core-js/modules/es6.date.to-json":"Gj6n","core-js/modules/es6.date.to-primitive":"jQnQ","core-js/modules/es6.function.has-instance":"a7bX","core-js/modules/es6.function.name":"N3yi","core-js/modules/es6.map":"ioKM","core-js/modules/es6.math.acosh":"py3M","core-js/modules/es6.math.asinh":"ob11","core-js/modules/es6.math.atanh":"iUik","core-js/modules/es6.math.cbrt":"YRuK","core-js/modules/es6.math.clz32":"R2Qc","core-js/modules/es6.math.cosh":"nEse","core-js/modules/es6.math.expm1":"AmoX","core-js/modules/es6.math.fround":"vmlq","core-js/modules/es6.math.hypot":"kLut","core-js/modules/es6.math.imul":"A8J8","core-js/modules/es6.math.log1p":"qtpC","core-js/modules/es6.math.log10":"VUW8","core-js/modules/es6.math.log2":"Jo9J","core-js/modules/es6.math.sign":"mZl9","core-js/modules/es6.math.sinh":"m0zb","core-js/modules/es6.math.tanh":"Fnqw","core-js/modules/es6.math.trunc":"tiOR","core-js/modules/es6.number.constructor":"kRGG","core-js/modules/es6.number.epsilon":"DzYy","core-js/modules/es6.number.is-finite":"FuY7","core-js/modules/es6.number.is-integer":"pwRL","core-js/modules/es6.number.is-nan":"SsgJ","core-js/modules/es6.number.is-safe-integer":"qVIE","core-js/modules/es6.number.max-safe-integer":"shx2","core-js/modules/es6.number.min-safe-integer":"ifBH","core-js/modules/es6.number.parse-float":"yjyf","core-js/modules/es6.number.parse-int":"Guno","core-js/modules/es6.object.assign":"K3Jy","core-js/modules/es7.object.define-getter":"guoQ","core-js/modules/es7.object.define-setter":"HMp9","core-js/modules/es7.object.entries":"gxEP","core-js/modules/es6.object.freeze":"EO7q","core-js/modules/es6.object.get-own-property-descriptor":"nIty","core-js/modules/es7.object.get-own-property-descriptors":"BQD8","core-js/modules/es6.object.get-own-property-names":"i23Y","core-js/modules/es6.object.get-prototype-of":"ud3u","core-js/modules/es7.object.lookup-getter":"HB2g","core-js/modules/es7.object.lookup-setter":"QF5J","core-js/modules/es6.object.prevent-extensions":"llMc","core-js/modules/es6.object.to-string":"zTK3","core-js/modules/es6.object.is":"MlqR","core-js/modules/es6.object.is-frozen":"Z1rp","core-js/modules/es6.object.is-sealed":"Fckj","core-js/modules/es6.object.is-extensible":"EYbC","core-js/modules/es6.object.keys":"m9aB","core-js/modules/es6.object.seal":"GYFR","core-js/modules/es6.object.set-prototype-of":"JGjq","core-js/modules/es7.object.values":"Ltmz","core-js/modules/es6.promise":"Pjta","core-js/modules/es7.promise.finally":"l1j0","core-js/modules/es6.reflect.apply":"F0Xu","core-js/modules/es6.reflect.construct":"JlFO","core-js/modules/es6.reflect.define-property":"S841","core-js/modules/es6.reflect.delete-property":"JRlJ","core-js/modules/es6.reflect.get":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor":"zj1X","core-js/modules/es6.reflect.get-prototype-of":"d0aC","core-js/modules/es6.reflect.has":"OWTq","core-js/modules/es6.reflect.is-extensible":"deHu","core-js/modules/es6.reflect.own-keys":"e6SV","core-js/modules/es6.reflect.prevent-extensions":"BmyK","core-js/modules/es6.reflect.set":"K46i","core-js/modules/es6.reflect.set-prototype-of":"L5z5","core-js/modules/es6.regexp.constructor":"BenF","core-js/modules/es6.regexp.flags":"pDhD","core-js/modules/es6.regexp.match":"RTfC","core-js/modules/es6.regexp.replace":"KGao","core-js/modules/es6.regexp.split":"aOHf","core-js/modules/es6.regexp.search":"zOab","core-js/modules/es6.regexp.to-string":"iflU","core-js/modules/es6.set":"coyu","core-js/modules/es6.symbol":"uVn9","core-js/modules/es7.symbol.async-iterator":"DlMC","core-js/modules/es6.string.anchor":"USd7","core-js/modules/es6.string.big":"c1D0","core-js/modules/es6.string.blink":"Ee86","core-js/modules/es6.string.bold":"ry39","core-js/modules/es6.string.code-point-at":"zR9y","core-js/modules/es6.string.ends-with":"zRn7","core-js/modules/es6.string.fixed":"AHLq","core-js/modules/es6.string.fontcolor":"H7V0","core-js/modules/es6.string.fontsize":"Dx83","core-js/modules/es6.string.from-code-point":"xSM3","core-js/modules/es6.string.includes":"fH7p","core-js/modules/es6.string.italics":"fRhg","core-js/modules/es6.string.iterator":"tbKg","core-js/modules/es6.string.link":"Aaz0","core-js/modules/es7.string.pad-start":"SWNE","core-js/modules/es7.string.pad-end":"n20m","core-js/modules/es6.string.raw":"t29D","core-js/modules/es6.string.repeat":"C85R","core-js/modules/es6.string.small":"qBr3","core-js/modules/es6.string.starts-with":"w2SA","core-js/modules/es6.string.strike":"eNyu","core-js/modules/es6.string.sub":"BVLK","core-js/modules/es6.string.sup":"kMsL","core-js/modules/es7.string.trim-left":"ppxd","core-js/modules/es7.string.trim-right":"hxx1","core-js/modules/es6.typed.array-buffer":"NJ0a","core-js/modules/es6.typed.int8-array":"wqMZ","core-js/modules/es6.typed.uint8-array":"QTtY","core-js/modules/es6.typed.uint8-clamped-array":"Kqgs","core-js/modules/es6.typed.int16-array":"fEGw","core-js/modules/es6.typed.uint16-array":"xyd6","core-js/modules/es6.typed.int32-array":"hIko","core-js/modules/es6.typed.uint32-array":"tNPN","core-js/modules/es6.typed.float32-array":"wisA","core-js/modules/es6.typed.float64-array":"mbTX","core-js/modules/es6.weak-map":"D6DP","core-js/modules/es6.weak-set":"bRUR","core-js/modules/web.timers":"OTsy","core-js/modules/web.immediate":"hZLH","core-js/modules/web.dom.iterable":"v6Aj","regenerator-runtime/runtime":"QVnC","stats.js/src/Stats":"RDO9","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","../src/index.js":"uBxZ"}]},{},["ODOB"], null) \ No newline at end of file diff --git a/example/bundle/selection.383a520f.js b/example/bundle/selection.383a520f.js index 4b63e86ac..9a6dcbf92 100644 --- a/example/bundle/selection.383a520f.js +++ b/example/bundle/selection.383a520f.js @@ -14,7 +14,7 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w,exports.buildPackedTree=B,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(r){return r&&r.__esModule?r:{default:r}}function a(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,o=function(){};return{s:o,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -29,11 +29,13 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,a=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,p=6*n,b=6*(n+t);pf&&(f=B),x&&wg&&(g=w);var E=r[p+2],D=r[p+3],S=E-D,_=E+D;Ss&&(s=_),x&&Ey&&(y=E);var F=r[p+4],M=r[p+5],T=F-M,I=F+M;Tl&&(l=I),x&&Fh&&(h=F)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,x&&(o[0]=v,o[1]=c,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(r,n,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,s=2*a.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var p=(x-h)/2,b=2*c;o[u+b+0]=h+p,o[u+b+1]=p+(Math.abs(h)+p)*f}return o}function w(o,i){function u(r,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&i>=w&&(E=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return r.offset=t,r.count=e,r;var v=h(r.boundingData,a,s,l,t,e,B);if(-1===v.axis)return r.offset=t,r.count=e,r;var c=y(x,s,l,t,e,v);if(c===t||c===t+e)r.offset=t,r.count=e;else{r.splitAxis=v.axis;var g=new n.default,p=t,b=c-t;r.left=g,g.boundingData=new Float32Array(6),d(s,p,b,g.boundingData,f),u(g,p,b,f,i+1);var D=new n.default,S=c,_=e-b;r.right=D,D.boundingData=new Float32Array(6),d(s,S,_,D.boundingData,f),u(D,S,_,f,i+1)}return r}v(o);var f=new Float32Array(6),s=b(o),l=i.strategy===e.SAH?p(s):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,E=!1,D=[],S=c(o);if(1===S.length){var _=new n.default,F=S[0];null!=o.boundingBox?(_.boundingData=(0,t.boxToArray)(o.boundingBox),g(s,F.offset,F.count,f)):(_.boundingData=new Float32Array(6),d(s,F.offset,F.count,_.boundingData,f)),u(_,F.offset,F.count,f),D.push(_)}else{var M,T=a(S);try{for(T.s();!(M=T.n()).done;){var I=M.value,j=new n.default;j.boundingData=new Float32Array(6),d(s,I.offset,I.count,j.boundingData,f),u(j,I.offset,I.count,f),D.push(j)}}catch(N){T.e(N)}finally{T.f()}}if(null==o.boundingBox){var L=new r.Box3;o.boundingBox=new r.Box3;var O,U=a(D);try{for(U.s();!(O=U.n()).done;){var H=O.value;o.boundingBox.union((0,t.arrayToBox)(H.boundingData,L))}}catch(N){U.e(N)}finally{U.f()}}return D}var A=32;exports.BYTES_PER_NODE=A;var m=65535;function B(r,n){for(var t,e,o,a=w(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[a+6]=d/4,d=c(d,y),e[a+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { @@ -559,11 +559,13 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTri=s;var e=require("three"),r=new e.Vector3,t=new e.Vector3,n=new e.Vector3,i=new e.Vector2,o=new e.Vector2,u=new e.Vector2,a=new e.Vector3,c=new e.Vector3;function f(r,t,n,i,o,u,a,f){if(null===(t.side===e.BackSide?i.intersectTriangle(a,u,o,!0,f):i.intersectTriangle(o,u,a,t.side!==e.DoubleSide,f)))return null;c.copy(f),c.applyMatrix4(r.matrixWorld);var l=n.ray.origin.distanceTo(c);return ln.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;h?(m=e+8,T=x[e+6]):(m=x[e+6],T=e+8);var b=v(m,o,i,s)?p(m,t,n,i):null;if(b){var A=b.point[w];if(h?A<=o[T+B]:A>=o[T+B+3])return b}var M=v(T,o,i,s)?p(T,t,n,i):null;return b&&M?b.distance<=M.distance?b:M:b||M||null}var x=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function s(e,r,t,i,a,o,s){for(var u=t.index,l=t.attributes.position,p=3*e,x=3*(r+e);p4&&void 0!==arguments[4]?arguments[4]:null,x=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function T(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var B=2*n,h=g,b=d,A=y;if(65535===b[B+15]){var M=i.geometry;return s(A[n+6],b[B+14],M,l,!1,x,c)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(p&&(O=f,w(S,h,q=v),w(z,h,O),U=p(q),(j=p(O))4&&void 0!==arguments[4]?arguments[4]:null,f=2*t,m=g,T=d,B=y;if(null===v&&(x.boundingBox||x.computeBoundingBox(),l.set(x.boundingBox.min,x.boundingBox.max,c),l.update(),v=l),!(65535===T[f+15])){var h=t+8,b=B[t+6];return w(h,m,o),v.intersectsBox(o)&&e(h,i,x,c,v)?!0:(w(b,m,o),!(!v.intersectsBox(o)||!e(b,i,x,c,v)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=x.index,q=x.attributes.position,O=B[t+6],C=T[f+14];if(u.copy(c).invert(),x.boundsTree){w(t,m,p),p.matrix.copy(u),p.update(),s.geometry=x;var N=x.boundsTree.shapecast(s,function(e){return p.intersectsBox(e)},function(e){e.a.applyMatrix4(c),e.b.applyMatrix4(c),e.c.applyMatrix4(c),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(c(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0},y,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[y]||(this._roots=(0,r.buildPackedTree)(e,i))}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,u=new n(r,f({},y,!0));if(u._roots=a,i){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==o&&(s.array.set(o),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(e){for(var t,n,i,o,a=e.index.array,u=e.attributes.position.array,s=this._roots,l=0,f=s.length;ld&&(d=x),my&&(y=m),Bh&&(h=B)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==d||o[e+4]!==y||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=d,o[e+4]=y,o[e+5]=h,!0)}var w=e+8,A=n[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var P=0;P<3;P++){var E=w+P,S=A+P,j=o[E],F=o[E+3],I=o[S],O=o[S+3];o[e+P]=jO?F:O}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),o=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=o[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=i[a+6],c=o[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,d=i[a+6],y=i[a+7],h=e(u,l,new Float32Array(n,4*a,6),y);h||(t(v,u+1),t(d,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,o=u(this._roots);try{for(o.s();!(i=o.n()).done;){var s=i.value;(0,a.setBuffer)(s),(0,a.raycast)(0,e,t,r,n)}}catch(l){o.e(l)}finally{o.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=null,o=u(this._roots);try{for(o.s();!(n=o.n()).done;){var s=n.value;(0,a.setBuffer)(s);var l=(0,a.raycastFirst)(0,e,t,r);null!=l&&(null==i||l.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,i){return i};var i,o=!1,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;if((0,a.setBuffer)(l),o=(0,a.shapecast)(0,e,t,r,n))break}}catch(f){s.e(f)}finally{s.f()}return(0,a.clearBuffer)(),o}},{key:"intersectsBox",value:function(e,t,r){return h.set(t.min,t.max,r),h.update(),this.shapecast(e,function(e){return h.intersectsBox(e)},function(e){return h.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),h.set(t.boundingBox.min,t.boundingBox.max,r),h.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=b),i&&(c=x);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){g.update();var h=e.distanceToTriangle(g,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r obb2.intersectsBox( box ), function ( tri ) { + cachedMesh.geometry = otherGeometry; + const res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { tri.a.applyMatrix4( geometryToBvh ); tri.b.applyMatrix4( geometryToBvh ); @@ -2455,14 +2453,14 @@ arrayToBox$1( left, float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; arrayToBox$1( right, float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( rightIntersection ) return true; @@ -2516,18 +2514,6 @@ } - function arrayToBox$1( nodeIndex32, array, target ) { - - target.min.x = array[ nodeIndex32 ]; - target.min.y = array[ nodeIndex32 + 1 ]; - target.min.z = array[ nodeIndex32 + 2 ]; - - target.max.x = array[ nodeIndex32 + 3 ]; - target.max.y = array[ nodeIndex32 + 4 ]; - target.max.z = array[ nodeIndex32 + 5 ]; - - } - const SKIP_GENERATION = Symbol( 'skip tree generation' ); const obb = new OrientedBox(); @@ -2535,6 +2521,7 @@ const tri2 = new SeparatingAxisTriangle(); const temp1 = new three.Vector3(); const temp2 = new three.Vector3(); + const tempBox = new three.Box3(); class MeshBVH { @@ -2578,17 +2565,17 @@ } - constructor( geo, options = {} ) { + constructor( geometry, options = {} ) { - if ( ! geo.isBufferGeometry ) { + if ( ! geometry.isBufferGeometry ) { throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); - } else if ( geo.attributes.position.isInterleavedBufferAttribute ) { + } else if ( geometry.attributes.position.isInterleavedBufferAttribute ) { throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); - } else if ( geo.index && geo.index.isInterleavedBufferAttribute ) { + } else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) { throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); @@ -2602,6 +2589,8 @@ maxLeafTris: 10, verbose: true, + setBoundingBox: true, + // undocumented options // Whether to skip generating the tree. Used for deserialization. @@ -2613,14 +2602,25 @@ this._roots = null; if ( ! options[ SKIP_GENERATION ] ) { - this._roots = buildPackedTree( geo, options ); + this._roots = buildPackedTree( geometry, options ); + + if ( ! geometry.boundingBox && options.setBoundingBox ) { + + geometry.boundingBox = this.getBoundingBox( new three.Box3() ); + + } } + // retain references to the geometry so we can use them it without having to + // take a geometry reference in every function. + this.geometry = geometry; + } - refit( geometry ) { + refit() { + const geometry = this.geometry; const indexArr = geometry.index.array; const posArr = geometry.attributes.position.array; let buffer, uint32Array, uint16Array, float32Array; @@ -2769,10 +2769,11 @@ /* Core Cast Functions */ raycast( mesh, raycaster, ray, intersects ) { + const geometry = this.geometry; for ( const root of this._roots ) { setBuffer( root ); - raycast( 0, mesh, raycaster, ray, intersects ); + raycast( 0, mesh, geometry, raycaster, ray, intersects ); } @@ -2782,11 +2783,12 @@ raycastFirst( mesh, raycaster, ray ) { + const geometry = this.geometry; let closestResult = null; for ( const root of this._roots ) { setBuffer( root ); - const result = raycastFirst( 0, mesh, raycaster, ray ); + const result = raycastFirst( 0, mesh, geometry, raycaster, ray ); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -2802,13 +2804,14 @@ } - intersectsGeometry( mesh, geometry, geomToMesh ) { + intersectsGeometry( mesh, otherGeometry, geomToMesh ) { + const geometry = this.geometry; let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = intersectsGeometry( 0, mesh, geometry, geomToMesh ); + result = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh ); if ( result ) { @@ -2829,11 +2832,12 @@ // default the triangle intersection function intersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained ); + const geometry = this.geometry; let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); + result = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); if ( result ) { @@ -2873,19 +2877,19 @@ } - closestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { + closestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { - if ( ! geom.boundingBox ) { + if ( ! otherGeometry.boundingBox ) { - geom.computeBoundingBox(); + otherGeometry.computeBoundingBox(); } - obb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh ); + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); obb.update(); - const pos = geom.attributes.position; - const index = geom.index; + const pos = otherGeometry.attributes.position; + const index = otherGeometry.index; let tempTarget1 = null; let tempTarget2 = null; @@ -3029,6 +3033,22 @@ } + getBoundingBox( target ) { + + target.makeEmpty(); + + const roots = this._roots; + roots.forEach( buffer => { + + arrayToBox$1( 0, new Float32Array( buffer ), tempBox ); + target.union( tempBox ); + + } ); + + return target; + + } + } const wiremat = new three.LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } ); diff --git a/umd/index.js.map b/umd/index.js.map index 1c6ad6c47..f0beb3e2b 100644 --- a/umd/index.js.map +++ b/umd/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// if the geometry doesn't have a bounding box, then let's politely populate it using\r\n\t// the work we did to determine the BVH root bounds\r\n\tif ( geo.boundingBox == null ) {\r\n\r\n\t\tconst rootBox = new Box3();\r\n\t\tgeo.boundingBox = new Box3();\r\n\r\n\t\tfor ( let root of roots ) {\r\n\r\n\t\t\tgeo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! geometry.boundingBox ) {\r\n\r\n\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( geometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n","import { Vector3, BufferAttribute } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geo, options = {} ) {\r\n\r\n\t\tif ( ! geo.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geo.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geo.index && geo.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geo, options );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\trefit( geometry ) {\r\n\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t_traverse( 0 );\r\n\r\n\t\t}\r\n\r\n\t\tfunction _traverse( node32Index ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\tconst leftChange = _traverse( left );\r\n\t\t\t\tconst rightChange = _traverse( right );\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, raycaster, ray );\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, geometry, geomToMesh ) {\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, geomToMesh );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\t// default the triangle intersection function\r\n\t\tintersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained );\r\n\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! geom.boundingBox ) {\r\n\r\n\t\t\tgeom.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = geom.attributes.position;\r\n\t\tconst index = geom.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","xyzFields","arrayToBox","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAE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,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","export function arrayToBox( nodeIndex32, array, target ) {\n\n\ttarget.min.x = array[ nodeIndex32 ];\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\n\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\n\n}\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tconst leftChange = _traverse( left );\n\t\t\t\tconst rightChange = _traverse( right );\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\n\n\t\t// default the triangle intersection function\n\t\tintersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained );\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\tbox => obb.intersectsBox( box ),\n\t\t\ttri => obb.intersectsTriangle( tri )\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\tbox => sphere.intersectsBox( box ),\n\t\t\ttri => tri.intersectsSphere( sphere )\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\n\t\t\ttri => {\n\n\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\ttri.update();\n\n\t\t\t\t}\n\n\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttri2.update();\n\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t},\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\n\t\t\ttri => {\n\n\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\tconst dist = point.distanceTo( temp );\n\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t}\n\n\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t},\n\t\t\tbox => box.distanceToPoint( point )\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAEnC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,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AE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file From 3af4c2676cb36abe0a5a7e1f49918764ca7b2978 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 10:24:23 -0800 Subject: [PATCH 100/139] new shapecast signature --- src/MeshBVH.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 85a1fa23f..681cfa83f 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -327,17 +327,34 @@ export default class MeshBVH { } - shapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) { + shapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) { + + // TODO: update shapecast function to fire a range function + // TODO: update this function to use range callback from shapecast, calling both the intersects tri and range functions + // TODO: update all other shapecast calls + + if ( callbacks instanceof Function ) { + + callbacks = { + + boundsTraverseOrder: _orderNodesFunc, + intersectsBounds: callbacks, + intersectsTriangle: _intersectsTriangleFunc, + intersectsRange: null, + + }; + + } // default the triangle intersection function - intersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained ); + const intersectsTriangleFunc = callbacks.intersectsTriangle || ( ( tri, a, b, c, contained ) => contained ); const geometry = this.geometry; let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); + result = shapecast( 0, mesh, geometry, callbacks.intersectsBounds, intersectsTriangleFunc, callbacks.orderNodes ); if ( result ) { From dac98906652e6a2409233a95d179cc282879b51f Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 19:25:34 -0800 Subject: [PATCH 101/139] Add callback object --- src/MeshBVH.js | 207 ++++++++++++++++++++++++---------- src/Utils/BufferNodeUtils.js | 31 +++++ src/castFunctions.template.js | 42 +------ 3 files changed, 183 insertions(+), 97 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 681cfa83f..683a7e6d5 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -12,7 +12,7 @@ import { setBuffer, clearBuffer, } from './castFunctions.js'; -import { arrayToBox } from './Utils/BufferNodeUtils.js'; +import { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js'; const SKIP_GENERATION = Symbol( 'skip tree generation' ); @@ -22,6 +22,7 @@ const tri2 = new SeparatingAxisTriangle(); const temp1 = new Vector3(); const temp2 = new Vector3(); const tempBox = new Box3(); +const triangle = new SeparatingAxisTriangle(); export default class MeshBVH { @@ -329,12 +330,23 @@ export default class MeshBVH { shapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) { - // TODO: update shapecast function to fire a range function - // TODO: update this function to use range callback from shapecast, calling both the intersects tri and range functions // TODO: update all other shapecast calls + const geometry = this.geometry; if ( callbacks instanceof Function ) { + if ( _intersectsTriangleFunc ) { + + const ogFunc = _intersectsTriangleFunc; + _intersectsTriangleFunc = ( offset, count, contained, depth ) => { + + // TODO: if we update the arguments we need to do so here + return iterateOverTriangles( offset, count, geometry, ogFunc, contained, depth, triangle ); + + }; + + } + callbacks = { boundsTraverseOrder: _orderNodesFunc, @@ -346,15 +358,56 @@ export default class MeshBVH { } - // default the triangle intersection function - const intersectsTriangleFunc = callbacks.intersectsTriangle || ( ( tri, a, b, c, contained ) => contained ); + let { + boundsTraverseOrder, + intersectsBounds, + intersectsRange, + intersectsTriangle, + } = callbacks; + + if ( intersectsRange && intersectsTriangle ) { + + const originalIntersectsRange = intersectsRange; + intersectsRange = ( offset, count, contained, depth ) => { + + if ( ! originalIntersectsRange( offset, count, contained, depth ) ) { + + // TODO: iterate over triangles + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); + + } + + return true; + + }; + + } else if ( ! intersectsRange ) { + + if ( intersectsTriangle ) { + + intersectsRange = ( offset, count, contained, depth ) => { + + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); + + }; + + } else { + + intersectsRange = ( tri, a, b, c, contained ) => { + + return contained; + + }; + + } + + } - const geometry = this.geometry; let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, geometry, callbacks.intersectsBounds, intersectsTriangleFunc, callbacks.orderNodes ); + result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder ); if ( result ) { @@ -378,8 +431,10 @@ export default class MeshBVH { return this.shapecast( mesh, - box => obb.intersectsBox( box ), - tri => obb.intersectsTriangle( tri ) + { + intersectsBounds: box => obb.intersectsBox( box ), + intersectsTriangle: tri => obb.intersectsTriangle( tri ) + } ); } @@ -388,8 +443,10 @@ export default class MeshBVH { return this.shapecast( mesh, - box => sphere.intersectsBox( box ), - tri => tri.intersectsSphere( sphere ) + { + intersectsBounds: box => sphere.intersectsBox( box ), + intersectsTriangle: tri => tri.intersectsSphere( sphere ) + } ); } @@ -425,66 +482,80 @@ export default class MeshBVH { let closestDistance = Infinity; this.shapecast( mesh, - ( box, isLeaf, score ) => score < closestDistance && score < maxThreshold, - tri => { + { - if ( tri.needsUpdate ) { + boundsTraverseOrder: box => { - tri.update(); + return obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ); - } + }, - const sphere1 = tri.sphere; - for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + intersectsBounds: ( box, isLeaf, score ) => { - setTriangle( tri2, i2, index, pos ); - tri2.a.applyMatrix4( geometryToBvh ); - tri2.b.applyMatrix4( geometryToBvh ); - tri2.c.applyMatrix4( geometryToBvh ); - tri2.sphere.setFromPoints( tri2.points ); + return score < closestDistance && score < maxThreshold; - const sphere2 = tri2.sphere; - const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; - if ( sphereDist > closestDistance ) { + }, - continue; + intersectsTriangle: tri => { + + if ( tri.needsUpdate ) { + + tri.update(); } - tri2.update(); + const sphere1 = tri.sphere; + for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { - const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); - if ( dist < closestDistance ) { + setTriangle( tri2, i2, index, pos ); + tri2.a.applyMatrix4( geometryToBvh ); + tri2.b.applyMatrix4( geometryToBvh ); + tri2.c.applyMatrix4( geometryToBvh ); + tri2.sphere.setFromPoints( tri2.points ); - if ( target1 ) { + const sphere2 = tri2.sphere; + const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; + if ( sphereDist > closestDistance ) { - target1.copy( tempTarget1 ); + continue; } - if ( target2 ) { + tri2.update(); - target2.copy( tempTarget2 ); + const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); + if ( dist < closestDistance ) { - } + if ( target1 ) { - closestDistance = dist; + target1.copy( tempTarget1 ); - } + } - // stop traversal if we find a point that's under the given threshold - if ( dist < minThreshold ) { + if ( target2 ) { - return true; + target2.copy( tempTarget2 ); + + } + + closestDistance = dist; + + } + + // stop traversal if we find a point that's under the given threshold + if ( dist < minThreshold ) { + + return true; + + } } - } + return false; - return false; + } - }, - box => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ) + } ); @@ -508,35 +579,49 @@ export default class MeshBVH { this.shapecast( mesh, - ( box, isLeaf, score ) => score < closestDistance && score < maxThreshold, - tri => { + { - tri.closestPointToPoint( point, temp ); - const dist = point.distanceTo( temp ); - if ( dist < closestDistance ) { + boundsTraverseOrder: box => { - if ( target ) { + return box.distanceToPoint( point ); - target.copy( temp ); + }, - } + intersectsBounds: ( box, isLeaf, score ) => { - closestDistance = dist; + return score < closestDistance && score < maxThreshold; - } + }, - if ( dist < minThreshold ) { + intersectsTriangle: tri => { - return true; + tri.closestPointToPoint( point, temp ); + const dist = point.distanceTo( temp ); + if ( dist < closestDistance ) { - } else { + if ( target ) { - return false; + target.copy( temp ); - } + } - }, - box => box.distanceToPoint( point ) + closestDistance = dist; + + } + + if ( dist < minThreshold ) { + + return true; + + } else { + + return false; + + } + + }, + + } ); diff --git a/src/Utils/BufferNodeUtils.js b/src/Utils/BufferNodeUtils.js index e85f8c4fd..0f3574c5e 100644 --- a/src/Utils/BufferNodeUtils.js +++ b/src/Utils/BufferNodeUtils.js @@ -1,3 +1,5 @@ +import { setTriangle } from './Utils/TriangleUtils.js'; + export function arrayToBox( nodeIndex32, array, target ) { target.min.x = array[ nodeIndex32 ]; @@ -9,3 +11,32 @@ export function arrayToBox( nodeIndex32, array, target ) { target.max.z = array[ nodeIndex32 + 5 ]; } + +export function iterateOverTriangles( + offset, + count, + geometry, + intersectsTriangleFunc, + contained, + depth, + triangle +) { + + const index = geometry.index; + const pos = geometry.attributes.position; + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + setTriangle( triangle, i, index, pos ); + triangle.needsUpdate = true; + + if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { + + return true; + + } + + } + + return false; + +} diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index c657184ca..abcc0c844 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -129,41 +129,12 @@ export const shapecast = ( function () { const _cachedBox1 = new Box3(); const _cachedBox2 = new Box3(); - function iterateOverTriangles( - offset, - count, - geometry, - intersectsTriangleFunc, - contained, - depth, - triangle - ) { - - const index = geometry.index; - const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { - - setTriangle( triangle, i, index, pos ); - triangle.needsUpdate = true; - - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { - - return true; - - } - - } - - return false; - - } - return function shapecast( nodeIndex32, mesh, geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc = null, depth = 0, triangle = _triangle, @@ -214,7 +185,7 @@ export const shapecast = ( function () { const offset = OFFSET( nodeIndex32 ); const count = COUNT( nodeIndex16 ); - return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); + return intersectsRangeFunc( offset, count, false, depth ); } else { @@ -271,7 +242,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); } else { @@ -282,7 +253,7 @@ export const shapecast = ( function () { mesh, geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc, depth + 1, triangle, @@ -305,12 +276,11 @@ export const shapecast = ( function () { let c2StopTraversal; if ( c2Intersection === CONTAINED ) { - const geometry = mesh.geometry; const offset = getLeftOffset( c2 ); const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); } else { @@ -321,7 +291,7 @@ export const shapecast = ( function () { mesh, geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc, depth + 1, triangle, From b618d1ff6332a4e9f7fbe5cf4a579ad6ff08d291 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 19:26:24 -0800 Subject: [PATCH 102/139] Enable testing --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9bc9b5d7d..a3de1c67d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -7,7 +7,7 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] + branches: [ master, dev-v0.4.0 ] jobs: build: From 0b9cb2f42d8e5b2e5ca97e98510f69287ca70774 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 19:30:08 -0800 Subject: [PATCH 103/139] Update import --- src/Utils/BufferNodeUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/BufferNodeUtils.js b/src/Utils/BufferNodeUtils.js index 0f3574c5e..c12a168ad 100644 --- a/src/Utils/BufferNodeUtils.js +++ b/src/Utils/BufferNodeUtils.js @@ -1,4 +1,4 @@ -import { setTriangle } from './Utils/TriangleUtils.js'; +import { setTriangle } from './TriangleUtils.js'; export function arrayToBox( nodeIndex32, array, target ) { From c47ca1a54613a9924d9f1de6c2ba5340684297e0 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 20:25:02 -0800 Subject: [PATCH 104/139] Remove sqrt calls from closest point to point --- src/MeshBVH.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 683a7e6d5..8521a1fcc 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -575,7 +575,9 @@ export default class MeshBVH { // skip checking if over maxThreshold // set minThreshold = maxThreshold to quickly check if a point is within a threshold // returns Infinity if no value found - let closestDistance = Infinity; + const minThresholdSq = minThreshold * minThreshold; + const maxThresholdSq = maxThreshold * maxThreshold; + let closestDistanceSq = Infinity; this.shapecast( mesh, @@ -583,21 +585,22 @@ export default class MeshBVH { boundsTraverseOrder: box => { - return box.distanceToPoint( point ); + temp.copy( point ).clamp( box.min, box.max ); + return temp.distanceToSquared( point ); }, intersectsBounds: ( box, isLeaf, score ) => { - return score < closestDistance && score < maxThreshold; + return score < closestDistanceSq && score < maxThresholdSq; }, intersectsTriangle: tri => { tri.closestPointToPoint( point, temp ); - const dist = point.distanceTo( temp ); - if ( dist < closestDistance ) { + const distSq = point.distanceToSquared( temp ); + if ( distSq < closestDistanceSq ) { if ( target ) { @@ -605,11 +608,11 @@ export default class MeshBVH { } - closestDistance = dist; + closestDistanceSq = distSq; } - if ( dist < minThreshold ) { + if ( distSq < minThresholdSq ) { return true; @@ -625,7 +628,7 @@ export default class MeshBVH { ); - return closestDistance; + return Math.sqrt( closestDistanceSq ); } From a92d62aba71a3a03435dcb4280d11e0fc8f97aba Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 20:29:42 -0800 Subject: [PATCH 105/139] Fix bounds --- CHANGELOG.md | 3 +++ src/MeshBVH.js | 11 ++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1119eab2c..8d630b569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. - Use `type: module` in package.json to enable use of es6 modules in node. - Remove ability to generate an unpacked BVH. +- Improved "closestPointToPoint" performance slightly. ### Fixed - `MeshBVHVisualizer` not using the new geometry BVH if one was generated. - `MeshBVHVisualizer` not using the new mesh if it was set. - Case where passing in null `intersectsTriangleFunc` to `MeshBVH.shapecast` could throw an error. +- Case where the buffer being raycast against was not cleared correctly if a BVH had multiple roots. + ## [0.3.7] - 2021-03-06 ### Fixed diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 8521a1fcc..7c0765a3a 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -275,11 +275,10 @@ export default class MeshBVH { setBuffer( root ); raycast( 0, mesh, geometry, raycaster, ray, intersects ); + clearBuffer(); } - clearBuffer(); - } raycastFirst( mesh, raycaster, ray ) { @@ -290,6 +289,7 @@ export default class MeshBVH { setBuffer( root ); const result = raycastFirst( 0, mesh, geometry, raycaster, ray ); + clearBuffer(); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -299,7 +299,6 @@ export default class MeshBVH { } - clearBuffer(); return closestResult; @@ -313,6 +312,7 @@ export default class MeshBVH { setBuffer( root ); result = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh ); + clearBuffer(); if ( result ) { @@ -322,8 +322,6 @@ export default class MeshBVH { } - clearBuffer(); - return result; } @@ -408,6 +406,7 @@ export default class MeshBVH { setBuffer( root ); result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder ); + clearBuffer(); if ( result ) { @@ -417,8 +416,6 @@ export default class MeshBVH { } - clearBuffer(); - return result; } From d7ecd9bd6c389acd06d17a8f946e21ce2d4fed86 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 20:32:17 -0800 Subject: [PATCH 106/139] Update geometry intersect function --- src/castFunctions.template.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index abcc0c844..0ecef4276 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -364,27 +364,33 @@ export const intersectsGeometry = ( function () { obb2.update(); cachedMesh.geometry = otherGeometry; - const res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + const res = otherGeometry.boundsTree.shapecast( cachedMesh, { - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); + intersectsBounds: box => obb2.intersectsBox( box ), - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + intersectsTriangle: tri => { - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { + tri.a.applyMatrix4( geometryToBvh ); + tri.b.applyMatrix4( geometryToBvh ); + tri.c.applyMatrix4( geometryToBvh ); + tri.update(); - return true; + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle2, i, thisIndex, thisPos ); + triangle2.update(); + if ( tri.intersectsTriangle( triangle2 ) ) { + + return true; + + } } - } + return false; - return false; + } } ); cachedMesh.geometry = null; From c144c16d397241eb5d66cf7c1e8c1feaa7225873 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 20:47:24 -0800 Subject: [PATCH 107/139] Fix tests --- src/MeshBVH.js | 11 +----- src/castFunctions.js | 76 +++++++++++++++-------------------------- test/ShapeCasts.test.js | 7 +--- 3 files changed, 29 insertions(+), 65 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 7c0765a3a..0f49c25b9 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -328,20 +328,12 @@ export default class MeshBVH { shapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) { - // TODO: update all other shapecast calls - const geometry = this.geometry; if ( callbacks instanceof Function ) { if ( _intersectsTriangleFunc ) { - const ogFunc = _intersectsTriangleFunc; - _intersectsTriangleFunc = ( offset, count, contained, depth ) => { - - // TODO: if we update the arguments we need to do so here - return iterateOverTriangles( offset, count, geometry, ogFunc, contained, depth, triangle ); - - }; + // TODO: if we update the arguments we need to do so here } @@ -370,7 +362,6 @@ export default class MeshBVH { if ( ! originalIntersectsRange( offset, count, contained, depth ) ) { - // TODO: iterate over triangles return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); } diff --git a/src/castFunctions.js b/src/castFunctions.js index 7785a59db..f5181b3dd 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -127,41 +127,12 @@ export const shapecast = ( function () { const _cachedBox1 = new Box3(); const _cachedBox2 = new Box3(); - function iterateOverTriangles( - offset, - count, - geometry, - intersectsTriangleFunc, - contained, - depth, - triangle - ) { - - const index = geometry.index; - const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { - - setTriangle( triangle, i, index, pos ); - triangle.needsUpdate = true; - - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { - - return true; - - } - - } - - return false; - - } - return function shapecast( nodeIndex32, mesh, geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc = null, depth = 0, triangle = _triangle, @@ -212,7 +183,7 @@ export const shapecast = ( function () { const offset = uint32Array[ nodeIndex32 + 6 ]; const count = uint16Array[ nodeIndex16 + 14 ]; - return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); + return intersectsRangeFunc( offset, count, false, depth ); } else { @@ -269,7 +240,8 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + console.log('CONTAINED 1'); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); } else { @@ -280,7 +252,7 @@ export const shapecast = ( function () { mesh, geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc, depth + 1, triangle, @@ -303,12 +275,12 @@ export const shapecast = ( function () { let c2StopTraversal; if ( c2Intersection === CONTAINED ) { - const geometry = mesh.geometry; const offset = getLeftOffset( c2 ); const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + console.log('CONTAINED 2'); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); } else { @@ -319,7 +291,7 @@ export const shapecast = ( function () { mesh, geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc, depth + 1, triangle, @@ -392,27 +364,33 @@ export const intersectsGeometry = ( function () { obb2.update(); cachedMesh.geometry = otherGeometry; - const res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + const res = otherGeometry.boundsTree.shapecast( cachedMesh, { - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); + intersectsBounds: box => obb2.intersectsBox( box ), - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + intersectsTriangle: tri => { - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { + tri.a.applyMatrix4( geometryToBvh ); + tri.b.applyMatrix4( geometryToBvh ); + tri.c.applyMatrix4( geometryToBvh ); + tri.update(); - return true; + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle2, i, thisIndex, thisPos ); + triangle2.update(); + if ( tri.intersectsTriangle( triangle2 ) ) { + + return true; + + } } - } + return false; - return false; + } } ); cachedMesh.geometry = null; diff --git a/test/ShapeCasts.test.js b/test/ShapeCasts.test.js index 1cc9ac78d..87ba6a662 100644 --- a/test/ShapeCasts.test.js +++ b/test/ShapeCasts.test.js @@ -28,12 +28,7 @@ Mesh.prototype.raycast = acceleratedRaycast; BufferGeometry.prototype.computeBoundsTree = computeBoundsTree; BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; -describe( 'Shape Casts', () => { - - describe( 'packed: false', () => runSuiteWithOptions( { packedData: false } ) ); - describe( 'packed: true', () => runSuiteWithOptions( { packedData: true } ) ); - -} ); +runSuiteWithOptions( {} ); function runSuiteWithOptions( defaultOptions ) { From 74742bf59d5929a2cb255986727c1655c4496348 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 20:52:58 -0800 Subject: [PATCH 108/139] fix cast functions --- src/castFunctions.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/castFunctions.js b/src/castFunctions.js index f5181b3dd..e0b4519ff 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -240,7 +240,6 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - console.log('CONTAINED 1'); c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); } else { @@ -279,7 +278,6 @@ export const shapecast = ( function () { const end = getRightEndOffset( c2 ); const count = end - offset; - console.log('CONTAINED 2'); c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); } else { From 9dc9013b79d1e969e914c7ecaeed760d6de21e76 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 21:18:50 -0800 Subject: [PATCH 109/139] README update, warning --- README.md | 62 +++++++++++++++++++++++++++++++------------------- src/MeshBVH.js | 2 ++ 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index b6a578d30..6ca6b756c 100644 --- a/README.md +++ b/README.md @@ -325,38 +325,54 @@ If a point is found that is closer than `minThreshold` then the function will re shapecast( mesh : Mesh, - intersectsBoundsFunc : ( - box : Box3, - isLeaf : Boolean, - score : Number | undefined, - depth : Number - ) => NOT_INTERSECTED | INTERSECTED | CONTAINED, - - intersectsTriangleFunc : ( - triangle : Triangle, - index1 : Number, - index2 : Number, - index3 : Number, - contained : Boolean, - depth : Number - ) => Boolean = null, - - orderNodesFunc : ( - box: Box3 - ) => Number = null + callbacks : { + + traverseBoundsOrder : ( + box: Box3 + ) => Number = null, + + intersectsBounds : ( + box : Box3, + isLeaf : Boolean, + score : Number | undefined, + depth : Number + ) => NOT_INTERSECTED | INTERSECTED | CONTAINED, + + intersectsRange : ( + triangleOffset : Number, + triangleCount : Number + contained : Boolean, + depth : Number + ) => Boolean = null, + + intersectsTriangle : ( + triangle : Triangle, + index1 : Number, + index2 : Number, + index3 : Number, + contained : Boolean, + depth : Number + ) => Boolean = null, + + } ) : Boolean ``` -A generalized cast function that can be used to implement intersection logic for custom shapes. This is used internally for [intersectsBox](#intersectsBox) and [intersectsSphere](#intersectsSphere). The function returns as soon as a triangle has been reported as intersected and returns `true` if a triangle has been intersected. The bounds are traversed in depth first order calling `orderNodesFunc`, `intersectsBoundsFunc` and `intersectsTrianglesFunc` for each node and using the results to determine traversal depth. The `depth` value passed to `intersectsBoundsFunc` and `intersectsTriangleFunc` indicates the depth of the bounds the provided box or bounds belongs to unless the triangles are indicated to be `CONTAINED`, in which case depth is the depth of the parent bounds that were contained. It can be used to precompute, cache, and then read information about a parent bound to improve performance while traversing. +A generalized cast function that can be used to implement intersection logic for custom shapes. This is used internally for [intersectsBox](#intersectsBox) and [intersectsSphere](#intersectsSphere). The function returns as soon as a triangle has been reported as intersected and returns `true` if a triangle has been intersected. The bounds are traversed in depth first order calling `traverseBoundsOrder`, `intersectsBoundsFunc`, `intersectsRange`, and intersectsTriangle for each node and using the results to determine traversal depth. The `depth` value passed to callbacks indicates the depth of the bounds the provided box or bounds belongs to unless the triangles are indicated to be `CONTAINED`, in which case depth is the depth of the parent bounds that were contained. It can be used to precompute, cache, and then read information about a parent bound to improve performance while traversing. `mesh` is the is the object this BVH is representing. -`intersectsBoundsFunc` takes the axis aligned bounding box representing an internal node local to the bvh, whether or not the node is a leaf, and the score calculated by `orderNodesFunc` and returns a constant indicating whether or not the bounds is intersected or contained and traversal should continue. If `CONTAINED` is returned then and optimization is triggered allowing all child triangles to be checked immediately rather than traversing the rest of the child bounds. +`callbacks` is a list of callback functions (defined below) used for traversing the tree. All functions except for `intersectsBounds` are optional. -`intersectsTriangleFunc` takes a triangle and the vertex indices used by the triangle from the geometry and returns whether or not the triangle has been intersected with. If the triangle is reported to be intersected the traversal ends and the `shapecast` function completes. If multiple triangles need to be collected or intersected return false here and push results onto an array. `contained` is set to `true` if one of the parent bounds was marked as entirely contained in the `intersectsBoundsFunc` function. +`traverseBoundsOrder` takes the axis aligned bounding box representing an internal node local to the bvh and returns a score (often distance) used to determine whether the left or right node should be traversed first. The shape with the lowest score is traversed first. + +`intersectsBounds` takes the axis aligned bounding box representing an internal node local to the bvh, whether or not the node is a leaf, and the score calculated by `orderNodesFunc` and returns a constant indicating whether or not the bounds is intersected or contained meaning traversal should continue. If `CONTAINED` is returned then and optimization is triggered allowing the range and / or triangle intersection callbacks to be run immediately rather than traversing the rest of the child bounds. + +`intersectsRange` takes a triangle offset and count representing the number of triangles to be iterated over. 1 triangle from this range represents 3 values in the geometry's index buffer. If this function returns true then traversal is stopped and `intersectsTriangle` is not called if provided. + +`intersectsTriangle` takes a triangle and the index buffer indices used by the triangle from the geometry and returns whether or not the triangle has been intersected with. If the triangle is reported to be intersected the traversal ends and the `shapecast` function completes. If multiple triangles need to be collected or intersected return false here and push results onto an array. `contained` is set to `true` if one of the parent bounds was marked as entirely contained in the `intersectsBoundsFunc` function. -`orderNodesFunc` takes the axis aligned bounding box representing an internal node local to the bvh and returns a score or distance representing the distance to the shape being intersected with. The shape with the lowest score is traversed first. ### .refit diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 0f49c25b9..afb5b9c11 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -346,6 +346,8 @@ export default class MeshBVH { }; + console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' ); + } let { From 00ea880858a1273471f94295dbd48ac513c449c7 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 21:20:47 -0800 Subject: [PATCH 110/139] Update tests --- test/ShapeCasts.test.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/test/ShapeCasts.test.js b/test/ShapeCasts.test.js index 87ba6a662..9512b04da 100644 --- a/test/ShapeCasts.test.js +++ b/test/ShapeCasts.test.js @@ -109,12 +109,14 @@ function runSuiteWithOptions( defaultOptions ) { let numContained = 0; bvh.shapecast( mesh, - getIntersectsBoxFunction( sphere ), - ( tri, i0, i1, i2, contained ) => { + { + intersectsBounds: getIntersectsBoxFunction( sphere ), + intersectsTriangle: ( tri, i0, i1, i2, contained ) => { - allContained = contained && allContained; - numContained ++; + allContained = contained && allContained; + numContained ++; + } } ); @@ -133,16 +135,18 @@ function runSuiteWithOptions( defaultOptions ) { let numContained = 0; bvh.shapecast( mesh, - getIntersectsBoxFunction( sphere ), - ( tri, i0, i1, i2, contained ) => { + { + intersectsBounds: getIntersectsBoxFunction( sphere ), + intersectsTriangle: ( tri, i0, i1, i2, contained ) => { - allContained = contained && allContained; - if ( contained ) { + allContained = contained && allContained; + if ( contained ) { - numContained ++; + numContained ++; - } + } + } } ); @@ -160,11 +164,13 @@ function runSuiteWithOptions( defaultOptions ) { let trianglesIterated = 0; bvh.shapecast( mesh, - getIntersectsBoxFunction( sphere ), - ( tri, i0, i1, i2, contained ) => { + { + intersectsBounds: getIntersectsBoxFunction( sphere ), + intersectsTriangle: ( tri, i0, i1, i2, contained ) => { - trianglesIterated ++; + trianglesIterated ++; + } } ); From 0687d9705c418d6d8e82c3b13226b79ee70c3a0a Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 22:15:14 -0800 Subject: [PATCH 111/139] Update examples --- example/characterMovement.js | 25 ++-- example/collectTriangles.js | 51 ++++--- example/physics.js | 43 +++--- example/sculpt.js | 97 ++++++------ example/selection.js | 279 ++++++++++++++++++----------------- 5 files changed, 260 insertions(+), 235 deletions(-) diff --git a/example/characterMovement.js b/example/characterMovement.js index 93c41605a..b07c6c6d4 100644 --- a/example/characterMovement.js +++ b/example/characterMovement.js @@ -380,20 +380,25 @@ function updatePlayer( delta ) { collider.geometry.boundsTree.shapecast( collider, - box => box.intersectsBox( tempBox ), - tri => { + { - const triPoint = tempVector; - const capsulePoint = tempVector2; + intersectsBounds: box => box.intersectsBox( tempBox ), - const distance = tri.closestPointToSegment( tempSegment, triPoint, capsulePoint ); - if ( distance < capsuleInfo.radius ) { + intersectsTriangle: tri => { - const depth = capsuleInfo.radius - distance; - const direction = capsulePoint.sub( triPoint ).normalize(); + const triPoint = tempVector; + const capsulePoint = tempVector2; - tempSegment.start.addScaledVector( direction, depth ); - tempSegment.end.addScaledVector( direction, depth ); + const distance = tri.closestPointToSegment( tempSegment, triPoint, capsulePoint ); + if ( distance < capsuleInfo.radius ) { + + const depth = capsuleInfo.radius - distance; + const direction = capsulePoint.sub( triPoint ).normalize(); + + tempSegment.start.addScaledVector( direction, depth ); + tempSegment.end.addScaledVector( direction, depth ); + + } } diff --git a/example/collectTriangles.js b/example/collectTriangles.js index 0936483df..6f93dc7b5 100644 --- a/example/collectTriangles.js +++ b/example/collectTriangles.js @@ -206,26 +206,30 @@ function render() { const tempVec = new THREE.Vector3(); bvh.shapecast( targetMesh, - box => { + { - const intersects = sphere.intersectsBox( box ); - const { min, max } = box; - if ( intersects ) { + intersectsBounds: box => { - for ( let x = 0; x <= 1; x ++ ) { + const intersects = sphere.intersectsBox( box ); + const { min, max } = box; + if ( intersects ) { - for ( let y = 0; y <= 1; y ++ ) { + for ( let x = 0; x <= 1; x ++ ) { - for ( let z = 0; z <= 1; z ++ ) { + for ( let y = 0; y <= 1; y ++ ) { - tempVec.set( - x === 0 ? min.x : max.x, - y === 0 ? min.y : max.y, - z === 0 ? min.z : max.z - ); - if ( ! sphere.containsPoint( tempVec ) ) { + for ( let z = 0; z <= 1; z ++ ) { - return INTERSECTED; + tempVec.set( + x === 0 ? min.x : max.x, + y === 0 ? min.y : max.y, + z === 0 ? min.z : max.z + ); + if ( ! sphere.containsPoint( tempVec ) ) { + + return INTERSECTED; + + } } @@ -233,24 +237,25 @@ function render() { } + return CONTAINED; + } - return CONTAINED; + return intersects ? INTERSECTED : NOT_INTERSECTED; - } + }, - return intersects ? INTERSECTED : NOT_INTERSECTED; + intersectsTriangle: ( tri, a, b, c, contained ) => { - }, - ( tri, a, b, c, contained ) => { + if ( contained || tri.intersectsSphere( sphere ) ) { - if ( contained || tri.intersectsSphere( sphere ) ) { + indices.push( a, b, c ); - indices.push( a, b, c ); + } - } + return false; - return false; + } } ); diff --git a/example/physics.js b/example/physics.js index 4c31bd580..c128f50dd 100644 --- a/example/physics.js +++ b/example/physics.js @@ -329,33 +329,38 @@ function updateSphereCollisions( deltaTime ) { let collided = false; bvh.shapecast( collider, - box => { + { + intersectsBounds: box => { - return box.intersectsSphere( tempSphere ); + return box.intersectsSphere( tempSphere ); - }, - tri => { + }, - // get delta between closest point and center - tri.closestPointToPoint( tempSphere.center, deltaVec ); - deltaVec.sub( tempSphere.center ); - const distance = deltaVec.length(); - if ( distance < tempSphere.radius ) { + intersectsTriangle: tri => { - // move the sphere position to be outside the triangle - const radius = tempSphere.radius; - const depth = distance - radius; - deltaVec.multiplyScalar( 1 / distance ); - tempSphere.center.addScaledVector( deltaVec, depth ); + // get delta between closest point and center + tri.closestPointToPoint( tempSphere.center, deltaVec ); + deltaVec.sub( tempSphere.center ); + const distance = deltaVec.length(); + if ( distance < tempSphere.radius ) { - collided = true; + // move the sphere position to be outside the triangle + const radius = tempSphere.radius; + const depth = distance - radius; + deltaVec.multiplyScalar( 1 / distance ); + tempSphere.center.addScaledVector( deltaVec, depth ); - } + collided = true; + + } + + }, + + traverseBoundsOrder: box => { - }, - box => { + return box.distanceToPoint( tempSphere.center ) - tempSphere.radius; - return box.distanceToPoint( tempSphere.center ) - tempSphere.radius; + }, } ); diff --git a/example/sculpt.js b/example/sculpt.js index 12903081c..7c311b5d8 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -293,26 +293,30 @@ function performStroke( point, brushObject, brushOnly = false, accumulatedTriang const bvh = targetMesh.geometry.boundsTree; bvh.shapecast( targetMesh, - box => { + { - const intersects = sphere.intersectsBox( box ); - const { min, max } = box; - if ( intersects ) { + intersectsBounds: box => { - for ( let x = 0; x <= 1; x ++ ) { + const intersects = sphere.intersectsBox( box ); + const { min, max } = box; + if ( intersects ) { - for ( let y = 0; y <= 1; y ++ ) { + for ( let x = 0; x <= 1; x ++ ) { - for ( let z = 0; z <= 1; z ++ ) { + for ( let y = 0; y <= 1; y ++ ) { - tempVec.set( - x === 0 ? min.x : max.x, - y === 0 ? min.y : max.y, - z === 0 ? min.z : max.z - ); - if ( ! sphere.containsPoint( tempVec ) ) { + for ( let z = 0; z <= 1; z ++ ) { - return INTERSECTED; + tempVec.set( + x === 0 ? min.x : max.x, + y === 0 ? min.y : max.y, + z === 0 ? min.z : max.z + ); + if ( ! sphere.containsPoint( tempVec ) ) { + + return INTERSECTED; + + } } @@ -320,60 +324,61 @@ function performStroke( point, brushObject, brushOnly = false, accumulatedTriang } + return CONTAINED; + } - return CONTAINED; + return intersects ? INTERSECTED : NOT_INTERSECTED; - } + }, - return intersects ? INTERSECTED : NOT_INTERSECTED; + intersectsTriangle: ( tri, a, b, c, contained ) => { - }, - ( tri, a, b, c, contained ) => { + const triIndex = ~ ~ ( a / 3 ); + triangles.add( triIndex ); + accumulatedTriangles.add( triIndex ); - const triIndex = ~ ~ ( a / 3 ); - triangles.add( triIndex ); - accumulatedTriangles.add( triIndex ); + const va = indexAttr.getX( a ); + const vb = indexAttr.getX( b ); + const vc = indexAttr.getX( c ); + if ( contained ) { - const va = indexAttr.getX( a ); - const vb = indexAttr.getX( b ); - const vc = indexAttr.getX( c ); - if ( contained ) { + indices.add( va ); + indices.add( vb ); + indices.add( vc ); - indices.add( va ); - indices.add( vb ); - indices.add( vc ); + accumulatedIndices.add( va ); + accumulatedIndices.add( vb ); + accumulatedIndices.add( vc ); - accumulatedIndices.add( va ); - accumulatedIndices.add( vb ); - accumulatedIndices.add( vc ); + } else { - } else { + if ( sphere.containsPoint( tri.a ) ) { - if ( sphere.containsPoint( tri.a ) ) { + indices.add( va ); + accumulatedIndices.add( va ); - indices.add( va ); - accumulatedIndices.add( va ); + } - } + if ( sphere.containsPoint( tri.b ) ) { - if ( sphere.containsPoint( tri.b ) ) { + indices.add( vb ); + accumulatedIndices.add( vb ); - indices.add( vb ); - accumulatedIndices.add( vb ); + } - } + if ( sphere.containsPoint( tri.c ) ) { - if ( sphere.containsPoint( tri.c ) ) { + indices.add( vc ); + accumulatedIndices.add( vc ); - indices.add( vc ); - accumulatedIndices.add( vc ); + } } - } + return false; - return false; + } } ); diff --git a/example/selection.js b/example/selection.js index a2c02dc5b..dcea10dbc 100644 --- a/example/selection.js +++ b/example/selection.js @@ -448,216 +448,220 @@ function updateSelection() { const indices = []; mesh.geometry.boundsTree.shapecast( mesh, - ( box, isLeaf, score, depth ) => { + { + intersectsBounds: ( box, isLeaf, score, depth ) => { - // check if bounds intersect or contain the lasso region - if ( ! params.useBoundsTree ) { + // check if bounds intersect or contain the lasso region + if ( ! params.useBoundsTree ) { - return INTERSECTED; + return INTERSECTED; - } + } - // Get the bounding box points - const { min, max } = box; - let index = 0; + // Get the bounding box points + const { min, max } = box; + let index = 0; - let minY = Infinity; - let maxY = - Infinity; - let minX = Infinity; - for ( let x = 0; x <= 1; x ++ ) { + let minY = Infinity; + let maxY = - Infinity; + let minX = Infinity; + for ( let x = 0; x <= 1; x ++ ) { - for ( let y = 0; y <= 1; y ++ ) { + for ( let y = 0; y <= 1; y ++ ) { - for ( let z = 0; z <= 1; z ++ ) { + for ( let z = 0; z <= 1; z ++ ) { - const v = boxPoints[ index ]; - v.x = x === 0 ? min.x : max.x; - v.y = y === 0 ? min.y : max.y; - v.z = z === 0 ? min.z : max.z; - v.w = 1; - v.applyMatrix4( toScreenSpaceMatrix ); - index ++; + const v = boxPoints[ index ]; + v.x = x === 0 ? min.x : max.x; + v.y = y === 0 ? min.y : max.y; + v.z = z === 0 ? min.z : max.z; + v.w = 1; + v.applyMatrix4( toScreenSpaceMatrix ); + index ++; - if ( v.y < minY ) minY = v.y; - if ( v.y > maxY ) maxY = v.y; - if ( v.x < minX ) minX = v.x; + if ( v.y < minY ) minY = v.y; + if ( v.y > maxY ) maxY = v.y; + if ( v.x < minX ) minX = v.x; + + } } } - } + // Find all the relevant segments here and cache them in the above array for + // subsequent child checks to use. + const parentSegments = perBoundsSegments[ depth - 1 ] || lassoSegments; + const segmentsToCheck = perBoundsSegments[ depth ] || []; + segmentsToCheck.length = 0; + perBoundsSegments[ depth ] = segmentsToCheck; + for ( let i = 0, l = parentSegments.length; i < l; i ++ ) { - // Find all the relevant segments here and cache them in the above array for - // subsequent child checks to use. - const parentSegments = perBoundsSegments[ depth - 1 ] || lassoSegments; - const segmentsToCheck = perBoundsSegments[ depth ] || []; - segmentsToCheck.length = 0; - perBoundsSegments[ depth ] = segmentsToCheck; - for ( let i = 0, l = parentSegments.length; i < l; i ++ ) { + const line = parentSegments[ i ]; + const sx = line.start.x; + const sy = line.start.y; + const ex = line.end.x; + const ey = line.end.y; + if ( sx < minX && ex < minX ) continue; - const line = parentSegments[ i ]; - const sx = line.start.x; - const sy = line.start.y; - const ex = line.end.x; - const ey = line.end.y; - if ( sx < minX && ex < minX ) continue; + const startAbove = sy > maxY; + const endAbove = ey > maxY; + if ( startAbove && endAbove ) continue; - const startAbove = sy > maxY; - const endAbove = ey > maxY; - if ( startAbove && endAbove ) continue; + const startBelow = sy < minY; + const endBelow = ey < minY; + if ( startBelow && endBelow ) continue; - const startBelow = sy < minY; - const endBelow = ey < minY; - if ( startBelow && endBelow ) continue; + segmentsToCheck.push( line ); - segmentsToCheck.push( line ); + } - } + if ( segmentsToCheck.length === 0 ) { - if ( segmentsToCheck.length === 0 ) { + return NOT_INTERSECTED; - return NOT_INTERSECTED; + } - } + // Get the screen space hull lines + const hull = getConvexHull( boxPoints ); + const lines = hull.map( ( p, i ) => { - // Get the screen space hull lines - const hull = getConvexHull( boxPoints ); - const lines = hull.map( ( p, i ) => { + const nextP = hull[ ( i + 1 ) % hull.length ]; + const line = boxLines[ i ]; + line.start.copy( p ); + line.end.copy( nextP ); + return line; - const nextP = hull[ ( i + 1 ) % hull.length ]; - const line = boxLines[ i ]; - line.start.copy( p ); - line.end.copy( nextP ); - return line; + } ); - } ); + // If a lasso point is inside the hull then it's intersected and cannot be contained + if ( pointRayCrossesSegments( segmentsToCheck[ 0 ].start, lines ) % 2 === 1 ) { - // If a lasso point is inside the hull then it's intersected and cannot be contained - if ( pointRayCrossesSegments( segmentsToCheck[ 0 ].start, lines ) % 2 === 1 ) { + return INTERSECTED; - return INTERSECTED; + } - } + // check if the screen space hull is in the lasso + let crossings = 0; + for ( let i = 0, l = hull.length; i < l; i ++ ) { - // check if the screen space hull is in the lasso - let crossings = 0; - for ( let i = 0, l = hull.length; i < l; i ++ ) { + const v = hull[ i ]; + const pCrossings = pointRayCrossesSegments( v, segmentsToCheck ); - const v = hull[ i ]; - const pCrossings = pointRayCrossesSegments( v, segmentsToCheck ); + if ( i === 0 ) { - if ( i === 0 ) { + crossings = pCrossings; - crossings = pCrossings; + } - } + // if two points on the hull have different amounts of crossings then + // it can only be intersected + if ( crossings !== pCrossings ) { - // if two points on the hull have different amounts of crossings then - // it can only be intersected - if ( crossings !== pCrossings ) { + return INTERSECTED; - return INTERSECTED; + } } - } + // check if there are any intersections + for ( let i = 0, l = lines.length; i < l; i ++ ) { - // check if there are any intersections - for ( let i = 0, l = lines.length; i < l; i ++ ) { + const boxLine = lines[ i ]; + for ( let s = 0, ls = segmentsToCheck.length; s < ls; s ++ ) { - const boxLine = lines[ i ]; - for ( let s = 0, ls = segmentsToCheck.length; s < ls; s ++ ) { + if ( lineCrossesLine( boxLine, segmentsToCheck[ s ] ) ) { - if ( lineCrossesLine( boxLine, segmentsToCheck[ s ] ) ) { + return INTERSECTED; - return INTERSECTED; + } } } - } + return crossings % 2 === 0 ? NOT_INTERSECTED : CONTAINED; - return crossings % 2 === 0 ? NOT_INTERSECTED : CONTAINED; + }, - }, - ( tri, a, b, c, contained, depth ) => { + intersectsTriangle: ( tri, a, b, c, contained, depth ) => { - // if the parent bounds were marked as contained - if ( contained ) { + // if the parent bounds were marked as contained + if ( contained ) { - indices.push( a, b, c ); - return params.selectModel; + indices.push( a, b, c ); + return params.selectModel; - } + } - // check all the segments if using no bounds tree - const segmentsToCheck = params.useBoundsTree ? perBoundsSegments[ depth ] : lassoSegments; - if ( params.selectionMode === 'centroid' ) { + // check all the segments if using no bounds tree + const segmentsToCheck = params.useBoundsTree ? perBoundsSegments[ depth ] : lassoSegments; + if ( params.selectionMode === 'centroid' ) { - // get the center of the triangle - const centroid = tri.a.add( tri.b ).add( tri.c ).multiplyScalar( 1 / 3 ); - centroid.applyMatrix4( toScreenSpaceMatrix ); + // get the center of the triangle + const centroid = tri.a.add( tri.b ).add( tri.c ).multiplyScalar( 1 / 3 ); + centroid.applyMatrix4( toScreenSpaceMatrix ); - // counting the crossings - const crossings = pointRayCrossesSegments( centroid, segmentsToCheck ); - if ( crossings % 2 === 1 ) { + // counting the crossings + const crossings = pointRayCrossesSegments( centroid, segmentsToCheck ); + if ( crossings % 2 === 1 ) { - indices.push( a, b, c ); - return params.selectModel; + indices.push( a, b, c ); + return params.selectModel; - } + } - } else if ( params.selectionMode === 'intersection' ) { + } else if ( params.selectionMode === 'intersection' ) { - // get the projected vertices - const vertices = [ - tri.a, - tri.b, - tri.c, - ]; + // get the projected vertices + const vertices = [ + tri.a, + tri.b, + tri.c, + ]; - for ( let j = 0; j < 3; j ++ ) { + for ( let j = 0; j < 3; j ++ ) { - const v = vertices[ j ]; - v.applyMatrix4( toScreenSpaceMatrix ); + const v = vertices[ j ]; + v.applyMatrix4( toScreenSpaceMatrix ); - const crossings = pointRayCrossesSegments( v, segmentsToCheck ); - if ( crossings % 2 === 1 ) { + const crossings = pointRayCrossesSegments( v, segmentsToCheck ); + if ( crossings % 2 === 1 ) { - indices.push( a, b, c ); - return params.selectModel; + indices.push( a, b, c ); + return params.selectModel; + + } } - } + // get the lines for the triangle + const lines = [ + boxLines[ 0 ], + boxLines[ 1 ], + boxLines[ 2 ], + ]; - // get the lines for the triangle - const lines = [ - boxLines[ 0 ], - boxLines[ 1 ], - boxLines[ 2 ], - ]; + lines[ 0 ].start.copy( tri.a ); + lines[ 0 ].end.copy( tri.b ); - lines[ 0 ].start.copy( tri.a ); - lines[ 0 ].end.copy( tri.b ); + lines[ 1 ].start.copy( tri.b ); + lines[ 1 ].end.copy( tri.c ); - lines[ 1 ].start.copy( tri.b ); - lines[ 1 ].end.copy( tri.c ); + lines[ 2 ].start.copy( tri.c ); + lines[ 2 ].end.copy( tri.a ); - lines[ 2 ].start.copy( tri.c ); - lines[ 2 ].end.copy( tri.a ); + for ( let i = 0; i < 3; i ++ ) { - for ( let i = 0; i < 3; i ++ ) { + const l = lines[ i ]; + for ( let s = 0, sl = segmentsToCheck.length; s < sl; s ++ ) { - const l = lines[ i ]; - for ( let s = 0, sl = segmentsToCheck.length; s < sl; s ++ ) { + if ( lineCrossesLine( l, segmentsToCheck[ s ] ) ) { - if ( lineCrossesLine( l, segmentsToCheck[ s ] ) ) { + indices.push( a, b, c ); + return params.selectModel; - indices.push( a, b, c ); - return params.selectModel; + } } @@ -665,11 +669,12 @@ function updateSelection() { } - } + return false; - return false; + } } + ); const traverseTime = window.performance.now() - startTime; From 5e567fad4f36c53b7c0cf972112305a28ec68c90 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 23:15:26 -0800 Subject: [PATCH 112/139] enable touch --- example/collectTriangles.js | 61 +++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/example/collectTriangles.js b/example/collectTriangles.js index 0936483df..20659201f 100644 --- a/example/collectTriangles.js +++ b/example/collectTriangles.js @@ -18,7 +18,7 @@ let stats; let scene, camera, renderer, controls; let targetMesh, brushMesh; let mouse = new THREE.Vector2(); -let mouseType = - 1; +let mouseType = - 1, brushActive = false; let lastTime; function init() { @@ -32,6 +32,7 @@ function init() { renderer.setClearColor( bgColor, 1 ); renderer.gammaOutput = true; document.body.appendChild( renderer.domElement ); + renderer.domElement.style.touchAction = 'none'; // scene setup scene = new THREE.Scene(); @@ -81,7 +82,6 @@ function init() { camera.far = 100; camera.updateProjectionMatrix(); - controls = new OrbitControls( camera, renderer.domElement ); // stats setup stats = new Stats(); @@ -92,18 +92,6 @@ function init() { gui.add( params, 'rotate' ); gui.open(); - controls.addEventListener( 'start', function () { - - this.active = true; - - } ); - - controls.addEventListener( 'end', function () { - - this.active = false; - - } ); - window.addEventListener( 'resize', function () { camera.aspect = window.innerWidth / window.innerHeight; @@ -113,24 +101,43 @@ function init() { }, false ); - window.addEventListener( 'mousemove', function ( e ) { + window.addEventListener( 'pointermove', function ( e ) { mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; } ); - window.addEventListener( 'mousedown', function ( e ) { + window.addEventListener( 'pointerdown', function ( e ) { + mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; + mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; mouseType = e.button; - } ); + // disable the controls early if we're over the object because on touch screens + // we're not constantly tracking where the cursor is. + const raycaster = new THREE.Raycaster(); + raycaster.setFromCamera( mouse, camera ); + raycaster.firstHitOnly = true; + + const res = raycaster.intersectObject( targetMesh, true ); + brushActive = true; + controls.enabled = res.length === 0; + + }, true ); - window.addEventListener( 'mouseup', function () { + window.addEventListener( 'pointerup', function ( e ) { mouseType = - 1; + if ( e.pointerType === 'touch' ) { - } ); + // disable the brush visualization when the pointer action is done only + // if it's on a touch device. + brushActive = false; + + } + + }, true ); window.addEventListener( 'contextmenu', function ( e ) { @@ -161,6 +168,20 @@ function init() { } ); + controls = new OrbitControls( camera, renderer.domElement ); + + controls.addEventListener( 'start', function () { + + this.active = true; + + } ); + + controls.addEventListener( 'end', function () { + + this.active = false; + + } ); + lastTime = window.performance.now(); } @@ -176,7 +197,7 @@ function render() { const colorAttr = geometry.getAttribute( 'color' ); const indexAttr = geometry.index; - if ( controls.active ) { + if ( controls.active || ! brushActive ) { brushMesh.visible = false; From a8d0142ec7b8681f60d74dec504442d3b02acc96 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 23:21:18 -0800 Subject: [PATCH 113/139] Enable touch support for sculpt example --- example/sculpt.js | 58 +++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 12903081c..4817969e3 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -22,6 +22,7 @@ let stats; let scene, camera, renderer, controls; let targetMesh, brush, symmetryBrush, bvhHelper; let normalZ = new THREE.Vector3( 0, 0, 1 ); +let brushActive = false; let mouse = new THREE.Vector2(), lastMouse = new THREE.Vector2(); let mouseState = false, lastMouseState = false; let lastCastPose = new THREE.Vector3(); @@ -107,6 +108,7 @@ function init() { renderer.setClearColor( bgColor, 1 ); renderer.gammaOutput = true; document.body.appendChild( renderer.domElement ); + renderer.domElement.style.touchAction = 'none'; // scene setup scene = new THREE.Scene(); @@ -152,9 +154,6 @@ function init() { camera.far = 100; camera.updateProjectionMatrix(); - controls = new OrbitControls( camera, renderer.domElement ); - controls.minDistance = 1.5; - // stats setup stats = new Stats(); document.body.appendChild( stats.dom ); @@ -201,18 +200,6 @@ function init() { } }, 'rebuildBVH' ); gui.open(); - controls.addEventListener( 'start', function () { - - this.active = true; - - } ); - - controls.addEventListener( 'end', function () { - - this.active = false; - - } ); - window.addEventListener( 'resize', function () { camera.aspect = window.innerWidth / window.innerHeight; @@ -222,22 +209,37 @@ function init() { }, false ); - window.addEventListener( 'mousemove', function ( e ) { + window.addEventListener( 'pointermove', function ( e ) { mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; } ); - window.addEventListener( 'mousedown', e => { + window.addEventListener( 'pointerdown', e => { + mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; + mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; mouseState = Boolean( e.buttons & 1 ); + brushActive = true; - } ); + const raycaster = new THREE.Raycaster(); + raycaster.setFromCamera( mouse, camera ); + raycaster.firstHitOnly = true; - window.addEventListener( 'mouseup', e => { + const res = raycaster.intersectObject( targetMesh ); + controls.enabled = res.length === 0; + + }, true ); + + window.addEventListener( 'pointerup', e => { mouseState = Boolean( e.buttons & 1 ); + if ( e.pointerType === 'touch' ) { + + brushActive = false; + + } } ); @@ -270,6 +272,21 @@ function init() { } ); + controls = new OrbitControls( camera, renderer.domElement ); + controls.minDistance = 1.5; + + controls.addEventListener( 'start', function () { + + this.active = true; + + } ); + + controls.addEventListener( 'end', function () { + + this.active = false; + + } ); + } // Run the perform the brush movement @@ -537,10 +554,11 @@ function render() { stats.begin(); - if ( controls.active ) { + if ( controls.active || ! brushActive ) { // If the controls are being used then don't perform the strokes brush.visible = false; + symmetryBrush.visible = false; lastCastPose.setScalar( Infinity ); } else { From 5e5d12805cf409cb2fc11d7a9852cc7ea5ac1a91 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 23:23:00 -0800 Subject: [PATCH 114/139] build update --- example/bundle/collectTriangles.9c45819a.js | 2 +- example/bundle/sculpt.493e9c78.js | 2 +- umd/index.js.map | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/bundle/collectTriangles.9c45819a.js b/example/bundle/collectTriangles.9c45819a.js index e2d95da05..8133adea0 100644 --- a/example/bundle/collectTriangles.9c45819a.js +++ b/example/bundle/collectTriangles.9c45819a.js @@ -569,5 +569,5 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR","./Utils/ArrayBoxUtilities.js":"a4zN"}],"uBxZ":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.acceleratedRaycast=f,exports.computeBoundsTree=p,exports.disposeBoundsTree=b,Object.defineProperty(exports,"MeshBVH",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"Visualizer",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"MeshBVHVisualizer",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"CENTER",{enumerable:!0,get:function(){return n.CENTER}}),Object.defineProperty(exports,"AVERAGE",{enumerable:!0,get:function(){return n.AVERAGE}}),Object.defineProperty(exports,"SAH",{enumerable:!0,get:function(){return n.SAH}}),Object.defineProperty(exports,"NOT_INTERSECTED",{enumerable:!0,get:function(){return n.NOT_INTERSECTED}}),Object.defineProperty(exports,"INTERSECTED",{enumerable:!0,get:function(){return n.INTERSECTED}}),Object.defineProperty(exports,"CONTAINED",{enumerable:!0,get:function(){return n.CONTAINED}}),Object.defineProperty(exports,"getBVHExtremes",{enumerable:!0,get:function(){return s.getBVHExtremes}}),Object.defineProperty(exports,"estimateMemoryInBytes",{enumerable:!0,get:function(){return s.estimateMemoryInBytes}}),Object.defineProperty(exports,"MeshBVHDebug",{enumerable:!0,get:function(){return u.MeshBVHDebug}});var e=require("three"),t=i(require("./MeshBVH.js")),r=i(require("./MeshBVHVisualizer.js")),n=require("./Constants.js"),s=require("./Utils/Debug.js"),u=require("./MeshBVHDebug.js");function i(e){return e&&e.__esModule?e:{default:e}}var o=new e.Ray,a=new e.Matrix4,c=e.Mesh.prototype.raycast;function f(e,t){if(this.geometry.boundsTree){if(void 0===this.material)return;if(a.copy(this.matrixWorld).invert(),o.copy(e.ray).applyMatrix4(a),!0===e.firstHitOnly){var r=this.geometry.boundsTree.raycastFirst(this,e,o);r&&t.push(r)}else this.geometry.boundsTree.raycast(this,e,o,t)}else c.call(this,e,t)}function p(e){return this.boundsTree=new t.default(this,e),this.boundsTree}function b(){this.boundsTree=null} },{"three":"dKqR","./MeshBVH.js":"nIyY","./MeshBVHVisualizer.js":"jNwr","./Constants.js":"tuIt","./Utils/Debug.js":"uNJb","./MeshBVHDebug.js":"HxoX"}],"hyUn":[function(require,module,exports) { -"use strict";require("core-js/modules/es6.array.copy-within"),require("core-js/modules/es6.array.fill"),require("core-js/modules/es6.array.find"),require("core-js/modules/es6.array.find-index"),require("core-js/modules/es7.array.flat-map"),require("core-js/modules/es6.array.from"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.array.iterator"),require("core-js/modules/es6.array.of"),require("core-js/modules/es6.array.sort"),require("core-js/modules/es6.array.species"),require("core-js/modules/es6.date.to-json"),require("core-js/modules/es6.date.to-primitive"),require("core-js/modules/es6.function.has-instance"),require("core-js/modules/es6.function.name"),require("core-js/modules/es6.map"),require("core-js/modules/es6.math.acosh"),require("core-js/modules/es6.math.asinh"),require("core-js/modules/es6.math.atanh"),require("core-js/modules/es6.math.cbrt"),require("core-js/modules/es6.math.clz32"),require("core-js/modules/es6.math.cosh"),require("core-js/modules/es6.math.expm1"),require("core-js/modules/es6.math.fround"),require("core-js/modules/es6.math.hypot"),require("core-js/modules/es6.math.imul"),require("core-js/modules/es6.math.log1p"),require("core-js/modules/es6.math.log10"),require("core-js/modules/es6.math.log2"),require("core-js/modules/es6.math.sign"),require("core-js/modules/es6.math.sinh"),require("core-js/modules/es6.math.tanh"),require("core-js/modules/es6.math.trunc"),require("core-js/modules/es6.number.constructor"),require("core-js/modules/es6.number.epsilon"),require("core-js/modules/es6.number.is-finite"),require("core-js/modules/es6.number.is-integer"),require("core-js/modules/es6.number.is-nan"),require("core-js/modules/es6.number.is-safe-integer"),require("core-js/modules/es6.number.max-safe-integer"),require("core-js/modules/es6.number.min-safe-integer"),require("core-js/modules/es6.number.parse-float"),require("core-js/modules/es6.number.parse-int"),require("core-js/modules/es6.object.assign"),require("core-js/modules/es7.object.define-getter"),require("core-js/modules/es7.object.define-setter"),require("core-js/modules/es7.object.entries"),require("core-js/modules/es6.object.freeze"),require("core-js/modules/es6.object.get-own-property-descriptor"),require("core-js/modules/es7.object.get-own-property-descriptors"),require("core-js/modules/es6.object.get-own-property-names"),require("core-js/modules/es6.object.get-prototype-of"),require("core-js/modules/es7.object.lookup-getter"),require("core-js/modules/es7.object.lookup-setter"),require("core-js/modules/es6.object.prevent-extensions"),require("core-js/modules/es6.object.to-string"),require("core-js/modules/es6.object.is"),require("core-js/modules/es6.object.is-frozen"),require("core-js/modules/es6.object.is-sealed"),require("core-js/modules/es6.object.is-extensible"),require("core-js/modules/es6.object.keys"),require("core-js/modules/es6.object.seal"),require("core-js/modules/es6.object.set-prototype-of"),require("core-js/modules/es7.object.values"),require("core-js/modules/es6.promise"),require("core-js/modules/es7.promise.finally"),require("core-js/modules/es6.reflect.apply"),require("core-js/modules/es6.reflect.construct"),require("core-js/modules/es6.reflect.define-property"),require("core-js/modules/es6.reflect.delete-property"),require("core-js/modules/es6.reflect.get"),require("core-js/modules/es6.reflect.get-own-property-descriptor"),require("core-js/modules/es6.reflect.get-prototype-of"),require("core-js/modules/es6.reflect.has"),require("core-js/modules/es6.reflect.is-extensible"),require("core-js/modules/es6.reflect.own-keys"),require("core-js/modules/es6.reflect.prevent-extensions"),require("core-js/modules/es6.reflect.set"),require("core-js/modules/es6.reflect.set-prototype-of"),require("core-js/modules/es6.regexp.constructor"),require("core-js/modules/es6.regexp.flags"),require("core-js/modules/es6.regexp.match"),require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es6.regexp.split"),require("core-js/modules/es6.regexp.search"),require("core-js/modules/es6.regexp.to-string"),require("core-js/modules/es6.set"),require("core-js/modules/es6.symbol"),require("core-js/modules/es7.symbol.async-iterator"),require("core-js/modules/es6.string.anchor"),require("core-js/modules/es6.string.big"),require("core-js/modules/es6.string.blink"),require("core-js/modules/es6.string.bold"),require("core-js/modules/es6.string.code-point-at"),require("core-js/modules/es6.string.ends-with"),require("core-js/modules/es6.string.fixed"),require("core-js/modules/es6.string.fontcolor"),require("core-js/modules/es6.string.fontsize"),require("core-js/modules/es6.string.from-code-point"),require("core-js/modules/es6.string.includes"),require("core-js/modules/es6.string.italics"),require("core-js/modules/es6.string.iterator"),require("core-js/modules/es6.string.link"),require("core-js/modules/es7.string.pad-start"),require("core-js/modules/es7.string.pad-end"),require("core-js/modules/es6.string.raw"),require("core-js/modules/es6.string.repeat"),require("core-js/modules/es6.string.small"),require("core-js/modules/es6.string.starts-with"),require("core-js/modules/es6.string.strike"),require("core-js/modules/es6.string.sub"),require("core-js/modules/es6.string.sup"),require("core-js/modules/es7.string.trim-left"),require("core-js/modules/es7.string.trim-right"),require("core-js/modules/es6.typed.array-buffer"),require("core-js/modules/es6.typed.int8-array"),require("core-js/modules/es6.typed.uint8-array"),require("core-js/modules/es6.typed.uint8-clamped-array"),require("core-js/modules/es6.typed.int16-array"),require("core-js/modules/es6.typed.uint16-array"),require("core-js/modules/es6.typed.int32-array"),require("core-js/modules/es6.typed.uint32-array"),require("core-js/modules/es6.typed.float32-array"),require("core-js/modules/es6.typed.float64-array"),require("core-js/modules/es6.weak-map"),require("core-js/modules/es6.weak-set"),require("core-js/modules/web.timers"),require("core-js/modules/web.immediate"),require("core-js/modules/web.dom.iterable"),require("regenerator-runtime/runtime");var e=n(require("stats.js/src/Stats")),r=u(require("dat.gui")),s=u(require("three")),o=require("three/examples/jsm/controls/OrbitControls.js"),t=require("../src/index.js");function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function u(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i();if(r&&r.has(e))return r.get(e);var s={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var u=o?Object.getOwnPropertyDescriptor(e,t):null;u&&(u.get||u.set)?Object.defineProperty(s,t,u):s[t]=e[t]}return s.default=e,r&&r.set(e,s),s}function n(e){return e&&e.__esModule?e:{default:e}}s.Mesh.prototype.raycast=t.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=t.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=t.disposeBoundsTree;var d,c,a,l,m,j,q,p,f={size:.1,rotate:!0},y=new s.Vector2,w=-1;function g(){(l=new s.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),l.setSize(window.innerWidth,window.innerHeight),l.setClearColor(1251612,1),l.gammaOutput=!0,document.body.appendChild(l.domElement),(c=new s.Scene).fog=new s.Fog(1251612,20,60);var t=new s.DirectionalLight(16777215,.5);t.position.set(1,1,1),c.add(t),c.add(new s.AmbientLight(16777215,.4));var i=new s.TorusKnotBufferGeometry(1,.4,800,400).toNonIndexed(),u=new Uint8Array(3*i.attributes.position.count);u.fill(255);var n=new s.BufferAttribute(u,3,!0);n.dynamic=!0,i.setAttribute("color",n);var g=new s.MeshStandardMaterial({color:16777215,roughness:.3,metalness:0,vertexColors:!0});(j=new s.Mesh(i,g)).geometry.computeBoundsTree(),c.add(j);var h=new s.SphereBufferGeometry(1,40,40),b=new s.MeshStandardMaterial({color:15483002,roughness:.75,metalness:0,transparent:!0,opacity:.5,premultipliedAlpha:!0,emissive:15483002,emissiveIntensity:.5});q=new s.Mesh(h,b),c.add(q),(a=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(3,3,3),a.far=100,a.updateProjectionMatrix(),m=new o.OrbitControls(a,l.domElement),d=new e.default,document.body.appendChild(d.dom);var v=new r.GUI;v.add(f,"size").min(.1).max(1).step(.1),v.add(f,"rotate"),v.open(),m.addEventListener("start",function(){this.active=!0}),m.addEventListener("end",function(){this.active=!1}),window.addEventListener("resize",function(){a.aspect=window.innerWidth/window.innerHeight,a.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("mousemove",function(e){y.x=e.clientX/window.innerWidth*2-1,y.y=-e.clientY/window.innerHeight*2+1}),window.addEventListener("mousedown",function(e){w=e.button}),window.addEventListener("mouseup",function(){w=-1}),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),f.size+=5e-4*r,f.size=Math.max(Math.min(f.size,1),.1),v.updateDisplay()}),p=window.performance.now()}function h(){requestAnimationFrame(h),d.begin();var e=j.geometry,r=e.boundsTree,o=e.getAttribute("color"),i=e.index;if(m.active)q.visible=!1;else{q.scale.setScalar(f.size);var u=new s.Raycaster;u.setFromCamera(y,a),u.firstHitOnly=!0;var n=u.intersectObject(j,!0);if(n.length){q.position.copy(n[0].point),m.enabled=!1,q.visible=!0;var g=new s.Matrix4;g.copy(j.matrixWorld).invert();var b=new s.Sphere;b.center.copy(q.position).applyMatrix4(g),b.radius=f.size;var v=[],x=new s.Vector3;if(r.shapecast(j,function(e){var r=b.intersectsBox(e),s=e.min,o=e.max;if(r){for(var i=0;i<=1;i++)for(var u=0;u<=1;u++)for(var n=0;n<=1;n++)if(x.set(0===i?s.x:o.x,0===u?s.y:o.y,0===n?s.z:o.z),!b.containsPoint(x))return t.INTERSECTED;return t.CONTAINED}return r?t.INTERSECTED:t.NOT_INTERSECTED},function(e,r,s,o,t){return(t||e.intersectsSphere(b))&&v.push(r,s,o),!1}),0===w||2===w){var E=255,M=255,z=255;0===w&&(E=15,M=78,z=85);for(var O=0,T=v.length;O2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Set,n=new l.Matrix4;n.copy(i.matrixWorld).invert();var u=new l.Sphere;u.center.copy(e).applyMatrix4(n),u.radius=M.size;var a=new Set,d=new l.Vector3,c=new l.Vector3,m=i.geometry.index,p=i.geometry.attributes.position,f=i.geometry.attributes.normal,q=new Set;i.geometry.boundsTree.shapecast(i,function(e){var r=u.intersectsBox(e),s=e.min,t=e.max;if(r){for(var o=0;o<=1;o++)for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)if(d.set(0===o?s.x:t.x,0===i?s.y:t.y,0===n?s.z:t.z),!u.containsPoint(d))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,i,n){var d=~~(r/3);q.add(d),t.add(d);var c=m.getX(r),l=m.getX(s),p=m.getX(i);return n?(a.add(c),a.add(l),a.add(p),o.add(c),o.add(l),o.add(p)):(u.containsPoint(e.a)&&(a.add(c),o.add(c)),u.containsPoint(e.b)&&(a.add(l),o.add(l)),u.containsPoint(e.c)&&(a.add(p),o.add(p))),!1});var y=new l.Vector3;y.copy(e).applyMatrix4(n);var g=new l.Vector3,w=0;if(a.forEach(function(e){d.fromBufferAttribute(f,e),c.add(d),s||(w++,d.fromBufferAttribute(p,e),g.add(d))}),c.normalize(),r.quaternion.setFromUnitVectors(h,c),w&&g.multiplyScalar(1/w),!s){var b=1e-4*M.intensity,v=new l.Plane;v.setFromNormalAndCoplanarPoint(c,g),a.forEach(function(e){d.fromBufferAttribute(p,e);var r=d.distanceTo(y),s=M.invert?-1:1,t=1-r/M.size;if("clay"===M.brush){t=Math.pow(t,3);var o=v.distanceToPoint(d),i=s*Math.min(4*t,1);d.addScaledVector(c,i*b-s*o*i*.3)}else if("normal"===M.brush)t=Math.pow(t,2),d.addScaledVector(c,s*t*b);else if("flatten"===M.brush){t=Math.pow(t,2);var n=v.distanceToPoint(d);d.addScaledVector(c,-n*t*M.intensity*.01*.5)}p.setXYZ(e,d.x,d.y,d.z),f.setXYZ(e,0,0,0)}),a.size&&(p.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active)n.visible=!1,B.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(w,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(M.size,M.size,.1),n.position.copy(c.point),u.visible=M.symmetrical,u.scale.set(M.size,M.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,B.x===1/0&&B.copy(c.point),v||x){for(var m=(w.x-b.x)*window.innerWidth*window.devicePixelRatio,p=(w.y-b.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(B),q=.15*M.size,y=Math.max(q/f,1/M.maxSteps),g=j*y,h=0,z=new Set,S=new Set;f>q&&j>200*M.size/c.distance&&(b.lerp(w,y),B.lerp(c.point,y),f-=q,j-=g,E(B,n,!1,z,S),M.symmetrical&&(B.x*=-1,E(B,u,!1,z,S),B.x*=-1),!(++h>M.maxSteps)););h>0?(P(z,S),i.geometry.boundsTree.refit(),a.update()):(E(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1))}else E(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,E(c.point,u,!0),c.point.x*=-1),b.copy(w),B.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,b.copy(w),B.setScalar(1/0)}x=v,t.render(r,s),e.end()}S(),V(); +"use strict";require("core-js/modules/es6.array.copy-within"),require("core-js/modules/es6.array.fill"),require("core-js/modules/es6.array.find"),require("core-js/modules/es6.array.find-index"),require("core-js/modules/es7.array.flat-map"),require("core-js/modules/es6.array.from"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.array.iterator"),require("core-js/modules/es6.array.of"),require("core-js/modules/es6.array.sort"),require("core-js/modules/es6.array.species"),require("core-js/modules/es6.date.to-json"),require("core-js/modules/es6.date.to-primitive"),require("core-js/modules/es6.function.has-instance"),require("core-js/modules/es6.function.name"),require("core-js/modules/es6.map"),require("core-js/modules/es6.math.acosh"),require("core-js/modules/es6.math.asinh"),require("core-js/modules/es6.math.atanh"),require("core-js/modules/es6.math.cbrt"),require("core-js/modules/es6.math.clz32"),require("core-js/modules/es6.math.cosh"),require("core-js/modules/es6.math.expm1"),require("core-js/modules/es6.math.fround"),require("core-js/modules/es6.math.hypot"),require("core-js/modules/es6.math.imul"),require("core-js/modules/es6.math.log1p"),require("core-js/modules/es6.math.log10"),require("core-js/modules/es6.math.log2"),require("core-js/modules/es6.math.sign"),require("core-js/modules/es6.math.sinh"),require("core-js/modules/es6.math.tanh"),require("core-js/modules/es6.math.trunc"),require("core-js/modules/es6.number.constructor"),require("core-js/modules/es6.number.epsilon"),require("core-js/modules/es6.number.is-finite"),require("core-js/modules/es6.number.is-integer"),require("core-js/modules/es6.number.is-nan"),require("core-js/modules/es6.number.is-safe-integer"),require("core-js/modules/es6.number.max-safe-integer"),require("core-js/modules/es6.number.min-safe-integer"),require("core-js/modules/es6.number.parse-float"),require("core-js/modules/es6.number.parse-int"),require("core-js/modules/es6.object.assign"),require("core-js/modules/es7.object.define-getter"),require("core-js/modules/es7.object.define-setter"),require("core-js/modules/es7.object.entries"),require("core-js/modules/es6.object.freeze"),require("core-js/modules/es6.object.get-own-property-descriptor"),require("core-js/modules/es7.object.get-own-property-descriptors"),require("core-js/modules/es6.object.get-own-property-names"),require("core-js/modules/es6.object.get-prototype-of"),require("core-js/modules/es7.object.lookup-getter"),require("core-js/modules/es7.object.lookup-setter"),require("core-js/modules/es6.object.prevent-extensions"),require("core-js/modules/es6.object.to-string"),require("core-js/modules/es6.object.is"),require("core-js/modules/es6.object.is-frozen"),require("core-js/modules/es6.object.is-sealed"),require("core-js/modules/es6.object.is-extensible"),require("core-js/modules/es6.object.keys"),require("core-js/modules/es6.object.seal"),require("core-js/modules/es6.object.set-prototype-of"),require("core-js/modules/es7.object.values"),require("core-js/modules/es6.promise"),require("core-js/modules/es7.promise.finally"),require("core-js/modules/es6.reflect.apply"),require("core-js/modules/es6.reflect.construct"),require("core-js/modules/es6.reflect.define-property"),require("core-js/modules/es6.reflect.delete-property"),require("core-js/modules/es6.reflect.get"),require("core-js/modules/es6.reflect.get-own-property-descriptor"),require("core-js/modules/es6.reflect.get-prototype-of"),require("core-js/modules/es6.reflect.has"),require("core-js/modules/es6.reflect.is-extensible"),require("core-js/modules/es6.reflect.own-keys"),require("core-js/modules/es6.reflect.prevent-extensions"),require("core-js/modules/es6.reflect.set"),require("core-js/modules/es6.reflect.set-prototype-of"),require("core-js/modules/es6.regexp.constructor"),require("core-js/modules/es6.regexp.flags"),require("core-js/modules/es6.regexp.match"),require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es6.regexp.split"),require("core-js/modules/es6.regexp.search"),require("core-js/modules/es6.regexp.to-string"),require("core-js/modules/es6.set"),require("core-js/modules/es6.symbol"),require("core-js/modules/es7.symbol.async-iterator"),require("core-js/modules/es6.string.anchor"),require("core-js/modules/es6.string.big"),require("core-js/modules/es6.string.blink"),require("core-js/modules/es6.string.bold"),require("core-js/modules/es6.string.code-point-at"),require("core-js/modules/es6.string.ends-with"),require("core-js/modules/es6.string.fixed"),require("core-js/modules/es6.string.fontcolor"),require("core-js/modules/es6.string.fontsize"),require("core-js/modules/es6.string.from-code-point"),require("core-js/modules/es6.string.includes"),require("core-js/modules/es6.string.italics"),require("core-js/modules/es6.string.iterator"),require("core-js/modules/es6.string.link"),require("core-js/modules/es7.string.pad-start"),require("core-js/modules/es7.string.pad-end"),require("core-js/modules/es6.string.raw"),require("core-js/modules/es6.string.repeat"),require("core-js/modules/es6.string.small"),require("core-js/modules/es6.string.starts-with"),require("core-js/modules/es6.string.strike"),require("core-js/modules/es6.string.sub"),require("core-js/modules/es6.string.sup"),require("core-js/modules/es7.string.trim-left"),require("core-js/modules/es7.string.trim-right"),require("core-js/modules/es6.typed.array-buffer"),require("core-js/modules/es6.typed.int8-array"),require("core-js/modules/es6.typed.uint8-array"),require("core-js/modules/es6.typed.uint8-clamped-array"),require("core-js/modules/es6.typed.int16-array"),require("core-js/modules/es6.typed.uint16-array"),require("core-js/modules/es6.typed.int32-array"),require("core-js/modules/es6.typed.uint32-array"),require("core-js/modules/es6.typed.float32-array"),require("core-js/modules/es6.typed.float64-array"),require("core-js/modules/es6.weak-map"),require("core-js/modules/es6.weak-set"),require("core-js/modules/web.timers"),require("core-js/modules/web.immediate"),require("core-js/modules/web.dom.iterable"),require("regenerator-runtime/runtime");var e,r,s,t,o,i,n,u,a,d=y(require("stats.js/src/Stats")),c=q(require("dat.gui")),l=q(require("three")),m=require("three/examples/jsm/controls/OrbitControls.js"),p=require("three/examples/jsm/utils/BufferGeometryUtils.js"),j=require("../src/index.js");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function q(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=f();if(r&&r.has(e))return r.get(e);var s={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=t?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(s,o,i):s[o]=e[o]}return s.default=e,r&&r.set(e,s),s}function y(e){return e&&e.__esModule?e:{default:e}}l.Mesh.prototype.raycast=j.acceleratedRaycast,l.BufferGeometry.prototype.computeBoundsTree=j.computeBoundsTree,l.BufferGeometry.prototype.disposeBoundsTree=j.disposeBoundsTree;var g,h=new l.Vector3(0,0,1),w=!1,b=new l.Vector2,v=new l.Vector2,x=!1,B=!1,M=new l.Vector3,z={size:.1,brush:"clay",intensity:50,maxSteps:10,invert:!1,symmetrical:!0,flatShading:!1,depth:10,displayHelper:!1};function S(){i&&(i.geometry.dispose(),i.material.dispose(),r.remove(i)),g||(g=(new l.TextureLoader).load("../textures/skinHazardousarts2.jpg"));var e=new l.IcosahedronBufferGeometry(1,100);e.deleteAttribute("uv"),(e=p.BufferGeometryUtils.mergeVertices(e)).attributes.position.setUsage(l.DynamicDrawUsage),e.attributes.normal.setUsage(l.DynamicDrawUsage),e.computeBoundsTree({setBoundingBox:!1}),(i=new l.Mesh(e,new l.MeshMatcapMaterial({flatShading:z.flatShading,matcap:g}))).material.matcap.encoding=l.sRGBEncoding,i.frustumCulled=!1,r.add(i),a||((a=new j.MeshBVHVisualizer(i,z.depth)).visible=z.displayHelper,r.add(a)),a.mesh=i,a.update()}function E(){(t=new l.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),t.setClearColor(1251612,1),t.gammaOutput=!0,document.body.appendChild(t.domElement),t.domElement.style.touchAction="none",(r=new l.Scene).fog=new l.Fog(1251612,20,60);var p=new l.DirectionalLight(16777215,.5);p.position.set(1,1,1),r.add(p),r.add(new l.AmbientLight(16777215,.4)),S();for(var j=[new l.Vector3,new l.Vector3(0,0,1)],f=0;f<50;f++){var q=f+1,y=Math.sin(2*Math.PI*f/50),g=Math.cos(2*Math.PI*f/50),h=Math.sin(2*Math.PI*q/50),v=Math.cos(2*Math.PI*q/50);j.push(new l.Vector3(y,g,0),new l.Vector3(h,v,0))}(n=new l.LineSegments).geometry.setFromPoints(j),n.material.color.set(16485376),r.add(n),u=n.clone(),r.add(u),(s=new l.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,3),s.far=100,s.updateProjectionMatrix(),e=new d.default,document.body.appendChild(e.dom);var B=new c.GUI,M=B.addFolder("Sculpting");M.add(z,"brush",["normal","clay","flatten"]),M.add(z,"size").min(.025).max(.25).step(.005),M.add(z,"intensity").min(1).max(100).step(1),M.add(z,"maxSteps").min(1).max(25).step(1),M.add(z,"symmetrical"),M.add(z,"invert"),M.add(z,"flatShading").onChange(function(e){i.material.flatShading=e,i.material.needsUpdate=!0}),M.open();var E=B.addFolder("BVH Helper");E.add(z,"depth").min(1).max(20).step(1).onChange(function(e){a.depth=parseFloat(e),a.update()}),E.add(z,"displayHelper").onChange(function(e){a.visible=e}),E.open(),B.add({reset:S},"reset"),B.add({rebuildBVH:function(){i.geometry.computeBoundsTree({setBoundingBox:!1}),a.update()}},"rebuildBVH"),B.open(),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("pointermove",function(e){b.x=e.clientX/window.innerWidth*2-1,b.y=-e.clientY/window.innerHeight*2+1}),window.addEventListener("pointerdown",function(e){b.x=e.clientX/window.innerWidth*2-1,b.y=-e.clientY/window.innerHeight*2+1,x=Boolean(1&e.buttons),w=!0;var r=new l.Raycaster;r.setFromCamera(b,s),r.firstHitOnly=!0;var t=r.intersectObject(i);o.enabled=0===t.length},!0),window.addEventListener("pointerup",function(e){x=Boolean(1&e.buttons),"touch"===e.pointerType&&(w=!1)}),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),z.size+=1e-4*r,z.size=Math.max(Math.min(z.size,.25),.025),B.updateDisplay()}),(o=new m.OrbitControls(s,t.domElement)).minDistance=1.5,o.addEventListener("start",function(){this.active=!0}),o.addEventListener("end",function(){this.active=!1})}function P(e,r){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Set,n=new l.Matrix4;n.copy(i.matrixWorld).invert();var u=new l.Sphere;u.center.copy(e).applyMatrix4(n),u.radius=z.size;var a=new Set,d=new l.Vector3,c=new l.Vector3,m=i.geometry.index,p=i.geometry.attributes.position,f=i.geometry.attributes.normal,q=new Set;i.geometry.boundsTree.shapecast(i,function(e){var r=u.intersectsBox(e),s=e.min,t=e.max;if(r){for(var o=0;o<=1;o++)for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)if(d.set(0===o?s.x:t.x,0===i?s.y:t.y,0===n?s.z:t.z),!u.containsPoint(d))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,i,n){var d=~~(r/3);q.add(d),t.add(d);var c=m.getX(r),l=m.getX(s),p=m.getX(i);return n?(a.add(c),a.add(l),a.add(p),o.add(c),o.add(l),o.add(p)):(u.containsPoint(e.a)&&(a.add(c),o.add(c)),u.containsPoint(e.b)&&(a.add(l),o.add(l)),u.containsPoint(e.c)&&(a.add(p),o.add(p))),!1});var y=new l.Vector3;y.copy(e).applyMatrix4(n);var g=new l.Vector3,w=0;if(a.forEach(function(e){d.fromBufferAttribute(f,e),c.add(d),s||(w++,d.fromBufferAttribute(p,e),g.add(d))}),c.normalize(),r.quaternion.setFromUnitVectors(h,c),w&&g.multiplyScalar(1/w),!s){var b=1e-4*z.intensity,v=new l.Plane;v.setFromNormalAndCoplanarPoint(c,g),a.forEach(function(e){d.fromBufferAttribute(p,e);var r=d.distanceTo(y),s=z.invert?-1:1,t=1-r/z.size;if("clay"===z.brush){t=Math.pow(t,3);var o=v.distanceToPoint(d),i=s*Math.min(4*t,1);d.addScaledVector(c,i*b-s*o*i*.3)}else if("normal"===z.brush)t=Math.pow(t,2),d.addScaledVector(c,s*t*b);else if("flatten"===z.brush){t=Math.pow(t,2);var n=v.distanceToPoint(d);d.addScaledVector(c,-n*t*z.intensity*.01*.5)}p.setXYZ(e,d.x,d.y,d.z),f.setXYZ(e,0,0,0)}),a.size&&(p.needsUpdate=!0)}}function V(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function T(){if(requestAnimationFrame(T),e.begin(),o.active||!w)n.visible=!1,u.visible=!1,M.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(b,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(z.size,z.size,.1),n.position.copy(c.point),u.visible=z.symmetrical,u.scale.set(z.size,z.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,M.x===1/0&&M.copy(c.point),x||B){for(var m=(b.x-v.x)*window.innerWidth*window.devicePixelRatio,p=(b.y-v.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(M),q=.15*z.size,y=Math.max(q/f,1/z.maxSteps),g=j*y,h=0,S=new Set,E=new Set;f>q&&j>200*z.size/c.distance&&(v.lerp(b,y),M.lerp(c.point,y),f-=q,j-=g,P(M,n,!1,S,E),z.symmetrical&&(M.x*=-1,P(M,u,!1,S,E),M.x*=-1),!(++h>z.maxSteps)););h>0?(V(S,E),i.geometry.boundsTree.refit(),a.update()):(P(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,P(c.point,u,!0),c.point.x*=-1))}else P(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,P(c.point,u,!0),c.point.x*=-1),v.copy(b),M.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,v.copy(b),M.setScalar(1/0)}B=x,t.render(r,s),e.end()}E(),T(); },{"core-js/modules/es6.array.copy-within":"tWTB","core-js/modules/es6.array.fill":"hUQ6","core-js/modules/es6.array.find":"Qppk","core-js/modules/es6.array.find-index":"sVmK","core-js/modules/es7.array.flat-map":"I8vV","core-js/modules/es6.array.from":"RRcs","core-js/modules/es7.array.includes":"TLss","core-js/modules/es6.array.iterator":"wVEN","core-js/modules/es6.array.of":"RB6b","core-js/modules/es6.array.sort":"nrVf","core-js/modules/es6.array.species":"smn3","core-js/modules/es6.date.to-json":"Gj6n","core-js/modules/es6.date.to-primitive":"jQnQ","core-js/modules/es6.function.has-instance":"a7bX","core-js/modules/es6.function.name":"N3yi","core-js/modules/es6.map":"ioKM","core-js/modules/es6.math.acosh":"py3M","core-js/modules/es6.math.asinh":"ob11","core-js/modules/es6.math.atanh":"iUik","core-js/modules/es6.math.cbrt":"YRuK","core-js/modules/es6.math.clz32":"R2Qc","core-js/modules/es6.math.cosh":"nEse","core-js/modules/es6.math.expm1":"AmoX","core-js/modules/es6.math.fround":"vmlq","core-js/modules/es6.math.hypot":"kLut","core-js/modules/es6.math.imul":"A8J8","core-js/modules/es6.math.log1p":"qtpC","core-js/modules/es6.math.log10":"VUW8","core-js/modules/es6.math.log2":"Jo9J","core-js/modules/es6.math.sign":"mZl9","core-js/modules/es6.math.sinh":"m0zb","core-js/modules/es6.math.tanh":"Fnqw","core-js/modules/es6.math.trunc":"tiOR","core-js/modules/es6.number.constructor":"kRGG","core-js/modules/es6.number.epsilon":"DzYy","core-js/modules/es6.number.is-finite":"FuY7","core-js/modules/es6.number.is-integer":"pwRL","core-js/modules/es6.number.is-nan":"SsgJ","core-js/modules/es6.number.is-safe-integer":"qVIE","core-js/modules/es6.number.max-safe-integer":"shx2","core-js/modules/es6.number.min-safe-integer":"ifBH","core-js/modules/es6.number.parse-float":"yjyf","core-js/modules/es6.number.parse-int":"Guno","core-js/modules/es6.object.assign":"K3Jy","core-js/modules/es7.object.define-getter":"guoQ","core-js/modules/es7.object.define-setter":"HMp9","core-js/modules/es7.object.entries":"gxEP","core-js/modules/es6.object.freeze":"EO7q","core-js/modules/es6.object.get-own-property-descriptor":"nIty","core-js/modules/es7.object.get-own-property-descriptors":"BQD8","core-js/modules/es6.object.get-own-property-names":"i23Y","core-js/modules/es6.object.get-prototype-of":"ud3u","core-js/modules/es7.object.lookup-getter":"HB2g","core-js/modules/es7.object.lookup-setter":"QF5J","core-js/modules/es6.object.prevent-extensions":"llMc","core-js/modules/es6.object.to-string":"zTK3","core-js/modules/es6.object.is":"MlqR","core-js/modules/es6.object.is-frozen":"Z1rp","core-js/modules/es6.object.is-sealed":"Fckj","core-js/modules/es6.object.is-extensible":"EYbC","core-js/modules/es6.object.keys":"m9aB","core-js/modules/es6.object.seal":"GYFR","core-js/modules/es6.object.set-prototype-of":"JGjq","core-js/modules/es7.object.values":"Ltmz","core-js/modules/es6.promise":"Pjta","core-js/modules/es7.promise.finally":"l1j0","core-js/modules/es6.reflect.apply":"F0Xu","core-js/modules/es6.reflect.construct":"JlFO","core-js/modules/es6.reflect.define-property":"S841","core-js/modules/es6.reflect.delete-property":"JRlJ","core-js/modules/es6.reflect.get":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor":"zj1X","core-js/modules/es6.reflect.get-prototype-of":"d0aC","core-js/modules/es6.reflect.has":"OWTq","core-js/modules/es6.reflect.is-extensible":"deHu","core-js/modules/es6.reflect.own-keys":"e6SV","core-js/modules/es6.reflect.prevent-extensions":"BmyK","core-js/modules/es6.reflect.set":"K46i","core-js/modules/es6.reflect.set-prototype-of":"L5z5","core-js/modules/es6.regexp.constructor":"BenF","core-js/modules/es6.regexp.flags":"pDhD","core-js/modules/es6.regexp.match":"RTfC","core-js/modules/es6.regexp.replace":"KGao","core-js/modules/es6.regexp.split":"aOHf","core-js/modules/es6.regexp.search":"zOab","core-js/modules/es6.regexp.to-string":"iflU","core-js/modules/es6.set":"coyu","core-js/modules/es6.symbol":"uVn9","core-js/modules/es7.symbol.async-iterator":"DlMC","core-js/modules/es6.string.anchor":"USd7","core-js/modules/es6.string.big":"c1D0","core-js/modules/es6.string.blink":"Ee86","core-js/modules/es6.string.bold":"ry39","core-js/modules/es6.string.code-point-at":"zR9y","core-js/modules/es6.string.ends-with":"zRn7","core-js/modules/es6.string.fixed":"AHLq","core-js/modules/es6.string.fontcolor":"H7V0","core-js/modules/es6.string.fontsize":"Dx83","core-js/modules/es6.string.from-code-point":"xSM3","core-js/modules/es6.string.includes":"fH7p","core-js/modules/es6.string.italics":"fRhg","core-js/modules/es6.string.iterator":"tbKg","core-js/modules/es6.string.link":"Aaz0","core-js/modules/es7.string.pad-start":"SWNE","core-js/modules/es7.string.pad-end":"n20m","core-js/modules/es6.string.raw":"t29D","core-js/modules/es6.string.repeat":"C85R","core-js/modules/es6.string.small":"qBr3","core-js/modules/es6.string.starts-with":"w2SA","core-js/modules/es6.string.strike":"eNyu","core-js/modules/es6.string.sub":"BVLK","core-js/modules/es6.string.sup":"kMsL","core-js/modules/es7.string.trim-left":"ppxd","core-js/modules/es7.string.trim-right":"hxx1","core-js/modules/es6.typed.array-buffer":"NJ0a","core-js/modules/es6.typed.int8-array":"wqMZ","core-js/modules/es6.typed.uint8-array":"QTtY","core-js/modules/es6.typed.uint8-clamped-array":"Kqgs","core-js/modules/es6.typed.int16-array":"fEGw","core-js/modules/es6.typed.uint16-array":"xyd6","core-js/modules/es6.typed.int32-array":"hIko","core-js/modules/es6.typed.uint32-array":"tNPN","core-js/modules/es6.typed.float32-array":"wisA","core-js/modules/es6.typed.float64-array":"mbTX","core-js/modules/es6.weak-map":"D6DP","core-js/modules/es6.weak-set":"bRUR","core-js/modules/web.timers":"OTsy","core-js/modules/web.immediate":"hZLH","core-js/modules/web.dom.iterable":"v6Aj","regenerator-runtime/runtime":"QVnC","stats.js/src/Stats":"RDO9","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","../src/index.js":"uBxZ"}]},{},["ODOB"], null) \ No newline at end of file diff --git a/umd/index.js.map b/umd/index.js.map index f0beb3e2b..250245b5f 100644 --- a/umd/index.js.map +++ b/umd/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","export function arrayToBox( nodeIndex32, array, target ) {\n\n\ttarget.min.x = array[ nodeIndex32 ];\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\n\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\n\n}\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tconst leftChange = _traverse( left );\n\t\t\t\tconst rightChange = _traverse( right );\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\n\n\t\t// default the triangle intersection function\n\t\tintersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained );\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tclearBuffer();\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\tbox => obb.intersectsBox( box ),\n\t\t\ttri => obb.intersectsTriangle( tri )\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\tbox => sphere.intersectsBox( box ),\n\t\t\ttri => tri.intersectsSphere( sphere )\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\n\t\t\ttri => {\n\n\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\ttri.update();\n\n\t\t\t\t}\n\n\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttri2.update();\n\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t},\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\n\t\t\ttri => {\n\n\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\tconst dist = point.distanceTo( temp );\n\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t}\n\n\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t},\n\t\t\tbox => box.distanceToPoint( point )\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle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,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","export function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\nconst tempBox = new Box3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geometry, options = {} ) {\r\n\r\n\t\tif ( ! geometry.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\tsetBoundingBox: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geometry, options );\r\n\r\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\r\n\r\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// retain references to the geometry so we can use them it without having to\r\n\t\t// take a geometry reference in every function.\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\trefit() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t_traverse( 0 );\r\n\r\n\t\t}\r\n\r\n\t\tfunction _traverse( node32Index ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\tconst leftChange = _traverse( left );\r\n\t\t\t\tconst rightChange = _traverse( right );\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\t// default the triangle intersection function\r\n\t\tintersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained );\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = otherGeometry.attributes.position;\r\n\t\tconst index = otherGeometry.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tgetBoundingBox( target ) {\r\n\r\n\t\ttarget.makeEmpty();\r\n\r\n\t\tconst roots = this._roots;\r\n\t\troots.forEach( buffer => {\r\n\r\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\r\n\t\t\ttarget.union( tempBox );\r\n\r\n\t\t} );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAEnC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAA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IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file From 11d3385368f2f67535de9e873edc9357d578f258 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 10 Mar 2021 23:28:48 -0800 Subject: [PATCH 115/139] Add refit test --- test/MeshBVH.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/MeshBVH.test.js b/test/MeshBVH.test.js index 4400fb973..0572257fc 100644 --- a/test/MeshBVH.test.js +++ b/test/MeshBVH.test.js @@ -179,6 +179,26 @@ describe( 'Bounds Tree', () => { } ); + describe( 'refit', () => { + + it( 'should resize the bounds to fit any updated triangles.', () => { + + const geom = new SphereBufferGeometry( 1, 10, 10 ); + geom.computeBoundsTree(); + + const debug = new MeshBVHDebug( geom.boundsTree, geom ); + expect( debug.validateBounds() ).toBe( true ); + + geom.attributes.position.setX( 0, 10 ); + expect( debug.validateBounds() ).toBe( false ); + + geom.boundsTree.refit(); + expect( debug.validateBounds() ).toBe( true ); + + } ); + + } ); + } ); describe( 'Serialization', () => { From 278506723e58c9145195c705891ffd2efbaf02b1 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 11 Mar 2021 00:28:36 -0800 Subject: [PATCH 116/139] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e39bfe221..8ef9034f2 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "module": "src/index.js", "main": "src/index.js", "type": "module", + "sideEffects": false, "scripts": { "generate-cast-functions": "node scripts/generate-cast-functions.js", "start": "npm run generate-cast-functions & concurrently \"parcel watch ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache\" \"rollup -w -c\" \"static-server\"", From b3e0cfb621dd66b16058e3361235a3f9e0762213 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 11 Mar 2021 00:32:05 -0800 Subject: [PATCH 117/139] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d630b569..100ee8a70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `MeshBVH.refit` function to refit the bounds to modified vertices. - `setBoundingBox` MeshBVH construction option. - `MeshBVH.getBoundingBox` function. +- `intersectsRange` callback option to `MeshBVH.shapecast`. ### Changed - Removed `src/worker/generateAsync.js` function. Use `GenerateMeshBVHWorker` instead. - Use `type: module` in package.json to enable use of es6 modules in node. +- Add `sideEffects: false` to package.json. - Remove ability to generate an unpacked BVH. - Improved "closestPointToPoint" performance slightly. +- `MeshBVH.shapecast` to take an object of callback functions instead of a list of function arguments. See README for new API. Calls using the old function will log a warning. ### Fixed - `MeshBVHVisualizer` not using the new geometry BVH if one was generated. @@ -22,7 +25,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Case where passing in null `intersectsTriangleFunc` to `MeshBVH.shapecast` could throw an error. - Case where the buffer being raycast against was not cleared correctly if a BVH had multiple roots. - ## [0.3.7] - 2021-03-06 ### Fixed - Include built umd file including v0.3.6 changes. From 4467e264b6fbe9cadefc049b8347511c45c925c6 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 11:39:57 -0800 Subject: [PATCH 118/139] fix bvh helper performance --- example/sculpt.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index ff1efacc2..065e70bcb 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -87,8 +87,11 @@ function reset() { if ( ! bvhHelper ) { bvhHelper = new MeshBVHVisualizer( targetMesh, params.depth ); - bvhHelper.visible = params.displayHelper; - scene.add( bvhHelper ); + if ( params.displayHelper ) { + + scene.add( bvhHelper ); + + } } @@ -184,7 +187,16 @@ function init() { } ); helperFolder.add( params, 'displayHelper' ).onChange( display => { - bvhHelper.visible = display; + if ( display ) { + + scene.add( bvhHelper ); + bvhHelper.update(); + + } else { + + scene.remove( bvhHelper ); + + } } ); helperFolder.open(); @@ -662,7 +674,12 @@ function render() { // the model but it's faster to do them here. updateNormals( changedTriangles, changedIndices ); targetMesh.geometry.boundsTree.refit(); - bvhHelper.update(); + + if ( bvhHelper.parent !== null ) { + + bvhHelper.update(); + + } } else { From 124a83a1d972c644c5ab89c988fef53d22a195a8 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 12:45:39 -0800 Subject: [PATCH 119/139] Update intersectTriangle signature --- src/MeshBVH.js | 13 +++++++++++-- src/Utils/BufferNodeUtils.js | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index afb5b9c11..beb9319f9 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -333,7 +333,16 @@ export default class MeshBVH { if ( _intersectsTriangleFunc ) { - // TODO: if we update the arguments we need to do so here + // Support the previous function signature that provided three sequential index buffer + // indices here. + const originalTriangleFunc = _intersectsTriangleFunc; + _intersectsTriangleFunc = ( tri, index, contained, depth ) => { + + const i3 = index * 3; + return originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth ); + + }; + } @@ -384,7 +393,7 @@ export default class MeshBVH { } else { - intersectsRange = ( tri, a, b, c, contained ) => { + intersectsRange = ( offset, count, contained ) => { return contained; diff --git a/src/Utils/BufferNodeUtils.js b/src/Utils/BufferNodeUtils.js index c12a168ad..2cb429f98 100644 --- a/src/Utils/BufferNodeUtils.js +++ b/src/Utils/BufferNodeUtils.js @@ -24,12 +24,12 @@ export function iterateOverTriangles( const index = geometry.index; const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + for ( let i = offset, l = count + offset; i < l; i ++ ) { - setTriangle( triangle, i, index, pos ); + setTriangle( triangle, i * 3, index, pos ); triangle.needsUpdate = true; - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { + if ( intersectsTriangleFunc( triangle, i, contained, depth ) ) { return true; From 6e208e9b4fd936559a73372a22051a6cd0909d05 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 12:46:30 -0800 Subject: [PATCH 120/139] Fix tests --- test/ShapeCasts.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/ShapeCasts.test.js b/test/ShapeCasts.test.js index 9512b04da..ebed2e65d 100644 --- a/test/ShapeCasts.test.js +++ b/test/ShapeCasts.test.js @@ -111,7 +111,7 @@ function runSuiteWithOptions( defaultOptions ) { mesh, { intersectsBounds: getIntersectsBoxFunction( sphere ), - intersectsTriangle: ( tri, i0, i1, i2, contained ) => { + intersectsTriangle: ( tri, index, contained ) => { allContained = contained && allContained; numContained ++; @@ -137,7 +137,7 @@ function runSuiteWithOptions( defaultOptions ) { mesh, { intersectsBounds: getIntersectsBoxFunction( sphere ), - intersectsTriangle: ( tri, i0, i1, i2, contained ) => { + intersectsTriangle: ( tri, index, contained ) => { allContained = contained && allContained; if ( contained ) { @@ -166,7 +166,7 @@ function runSuiteWithOptions( defaultOptions ) { mesh, { intersectsBounds: getIntersectsBoxFunction( sphere ), - intersectsTriangle: ( tri, i0, i1, i2, contained ) => { + intersectsTriangle: () => { trianglesIterated ++; From 9b3fc98126803a626029829795177960310f6373 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 13:02:18 -0800 Subject: [PATCH 121/139] README, CHANGELOG update --- CHANGELOG.md | 2 +- README.md | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 100ee8a70..2e558b429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add `sideEffects: false` to package.json. - Remove ability to generate an unpacked BVH. - Improved "closestPointToPoint" performance slightly. -- `MeshBVH.shapecast` to take an object of callback functions instead of a list of function arguments. See README for new API. Calls using the old function will log a warning. +- `MeshBVH.shapecast` to take an object of callback functions instead of a list of function arguments and the triangle intersection callback has been changed to take a single triangle index. See README for new API. Calls using the old function will log a warning. ### Fixed - `MeshBVHVisualizer` not using the new geometry BVH if one was generated. diff --git a/README.md b/README.md index 6ca6b756c..8b0627fd7 100644 --- a/README.md +++ b/README.md @@ -347,9 +347,7 @@ shapecast( intersectsTriangle : ( triangle : Triangle, - index1 : Number, - index2 : Number, - index3 : Number, + triangleIndex : Number, contained : Boolean, depth : Number ) => Boolean = null, From 6cc6e094299e3f597fdd56d2a0544943af1ba57c Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 13:07:41 -0800 Subject: [PATCH 122/139] fix examples --- example/collectTriangles.js | 5 +++-- example/sculpt.js | 8 ++++++-- example/selection.js | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/example/collectTriangles.js b/example/collectTriangles.js index 057c0d7ba..ab0d71c66 100644 --- a/example/collectTriangles.js +++ b/example/collectTriangles.js @@ -266,11 +266,12 @@ function render() { }, - intersectsTriangle: ( tri, a, b, c, contained ) => { + intersectsTriangle: ( tri, i, contained ) => { if ( contained || tri.intersectsSphere( sphere ) ) { - indices.push( a, b, c ); + const i3 = 3 * i; + indices.push( i3, i3 + 1, i3 + 2 ); } diff --git a/example/sculpt.js b/example/sculpt.js index 065e70bcb..20032cd2a 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -361,12 +361,16 @@ function performStroke( point, brushObject, brushOnly = false, accumulatedTriang }, - intersectsTriangle: ( tri, a, b, c, contained ) => { + intersectsTriangle: ( tri, index, contained ) => { - const triIndex = ~ ~ ( a / 3 ); + const triIndex = index; triangles.add( triIndex ); accumulatedTriangles.add( triIndex ); + const i3 = 3 * index; + const a = i3 + 0; + const b = i3 + 1; + const c = i3 + 2; const va = indexAttr.getX( a ); const vb = indexAttr.getX( b ); const vc = indexAttr.getX( c ); diff --git a/example/selection.js b/example/selection.js index dcea10dbc..b5935c0f1 100644 --- a/example/selection.js +++ b/example/selection.js @@ -584,7 +584,12 @@ function updateSelection() { }, - intersectsTriangle: ( tri, a, b, c, contained, depth ) => { + intersectsTriangle: ( tri, index, contained, depth ) => { + + const i3 = index * 3; + const a = i3 + 0; + const b = i3 + 1; + const c = i3 + 2; // if the parent bounds were marked as contained if ( contained ) { From d1078b13019c0f4df913a217af367b2be7e5e87b Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 13:23:29 -0800 Subject: [PATCH 123/139] Pass through node indices --- src/castFunctions.template.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 0ecef4276..2198aa438 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -233,7 +233,7 @@ export const shapecast = ( function () { } const isC1Leaf = IS_LEAF( c1 ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 ); let c1StopTraversal; if ( c1Intersection === CONTAINED ) { @@ -271,7 +271,7 @@ export const shapecast = ( function () { arrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); const isC2Leaf = IS_LEAF( c2 ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 ); let c2StopTraversal; if ( c2Intersection === CONTAINED ) { From 7655e845ca3db072c8f35e4595c55ec56b5fd6ce Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 13:24:59 -0800 Subject: [PATCH 124/139] README update --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8b0627fd7..75057e0b1 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,8 @@ shapecast( box : Box3, isLeaf : Boolean, score : Number | undefined, - depth : Number + depth : Number, + nodeIndex : Number ) => NOT_INTERSECTED | INTERSECTED | CONTAINED, intersectsRange : ( @@ -365,7 +366,7 @@ A generalized cast function that can be used to implement intersection logic for `traverseBoundsOrder` takes the axis aligned bounding box representing an internal node local to the bvh and returns a score (often distance) used to determine whether the left or right node should be traversed first. The shape with the lowest score is traversed first. -`intersectsBounds` takes the axis aligned bounding box representing an internal node local to the bvh, whether or not the node is a leaf, and the score calculated by `orderNodesFunc` and returns a constant indicating whether or not the bounds is intersected or contained meaning traversal should continue. If `CONTAINED` is returned then and optimization is triggered allowing the range and / or triangle intersection callbacks to be run immediately rather than traversing the rest of the child bounds. +`intersectsBounds` takes the axis aligned bounding box representing an internal node local to the bvh, whether or not the node is a leaf, and the score calculated by `orderNodesFunc`, the node depth, and the node index (for use with the [refit](#refit) function) and returns a constant indicating whether or not the bounds is intersected or contained meaning traversal should continue. If `CONTAINED` is returned then and optimization is triggered allowing the range and / or triangle intersection callbacks to be run immediately rather than traversing the rest of the child bounds. `intersectsRange` takes a triangle offset and count representing the number of triangles to be iterated over. 1 triangle from this range represents 3 values in the geometry's index buffer. If this function returns true then traversal is stopped and `intersectsTriangle` is not called if provided. From 8dd52632de12ab77998b108f1ca0b5acf8437744 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 13:32:30 -0800 Subject: [PATCH 125/139] update benchmark --- benchmark/run-benchmark.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index 659d5f898..0a1f9f875 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -186,9 +186,15 @@ function runSuite( strategy ) { null, () => { - mesh.geometry.boundsTree.shapecast( mesh, box => sphere.intersectsBox( box ), tri => { + mesh.geometry.boundsTree.shapecast( mesh, { - tri.intersectsSphere( sphere ); + intersectsBounds: box => sphere.intersectsBox( box ), + + intersectsTriangle: tri => { + + tri.intersectsSphere( sphere ); + + }, } ); From b03b8f3153e62a2e32c14ad14ccccbd627549d7a Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 17:10:30 -0800 Subject: [PATCH 126/139] Add more optimal refit, add benchmark --- benchmark/run-benchmark.js | 51 ++++++++++++++++++++++++++++++++++- src/MeshBVH.js | 37 ++++++++++++++++++++++--- src/castFunctions.js | 14 +++++----- src/castFunctions.template.js | 10 +++---- 4 files changed, 95 insertions(+), 17 deletions(-) diff --git a/benchmark/run-benchmark.js b/benchmark/run-benchmark.js index 0a1f9f875..8d7baa43c 100644 --- a/benchmark/run-benchmark.js +++ b/benchmark/run-benchmark.js @@ -46,6 +46,40 @@ function runSuite( strategy ) { const options = { strategy }; geometry.computeBoundsTree( options ); + + // generate a set of node indices to use with an optimized refit function + const refitIndices = new Set(); + const terminationIndices = new Set(); + const newSphere = new THREE.Sphere( + new THREE.Vector3( 0, 0, 0 ), + 0.5, + ); + geometry.boundsTree.shapecast( + mesh, + { + + intersectsBounds: ( box, isLeaf, score, depth, nodeIndex ) => { + + if ( box.intersectsSphere( newSphere ) ) { + + refitIndices.add( nodeIndex ); + return true; + + } + + return false; + + }, + + intersectsRange: ( offset, count, contained, depth, nodeIndex ) => { + + terminationIndices.add( nodeIndex ); + + } + + } + ); + logExtremes( geometry.boundsTree, geometry ); geometry.computeBoundingBox(); @@ -122,7 +156,22 @@ function runSuite( strategy ) { null, () => { - geometry.boundsTree.refit( geometry ); + geometry.boundsTree.refit(); + + }, + 3000, + 50 + + ); + + runBenchmark( + + 'Refit w/ hints', + null, + () => { + + geometry.boundsTree.refit( refitIndices, terminationIndices ); + }, 3000, diff --git a/src/MeshBVH.js b/src/MeshBVH.js index beb9319f9..89f7ea905 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -119,7 +119,20 @@ export default class MeshBVH { } - refit() { + refit( nodeIndices = null, terminationIndices = null ) { + + if ( nodeIndices && Array.isArray( nodeIndices ) ) { + + nodeIndices = new Set( nodeIndices ); + + } + + + if ( terminationIndices && Array.isArray( terminationIndices ) ) { + + terminationIndices = new Set( terminationIndices ); + + } const geometry = this.geometry; const indexArr = geometry.index.array; @@ -136,7 +149,7 @@ export default class MeshBVH { } - function _traverse( node32Index ) { + function _traverse( node32Index, force = false ) { const node16Index = node32Index * 2; const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; @@ -200,8 +213,24 @@ export default class MeshBVH { const left = node32Index + 8; const right = uint32Array[ node32Index + 6 ]; - const leftChange = _traverse( left ); - const rightChange = _traverse( right ); + let leftChange = false; + let forceLeft = force || terminationIndices && terminationIndices.has( left ); + let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true ); + if ( traverseLeft ) { + + leftChange = _traverse( left, forceLeft ); + + } + + let rightChange = false; + let forceRight = force || terminationIndices && terminationIndices.has( right ); + let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true ); + if ( traverseRight ) { + + rightChange = _traverse( right, forceRight ); + + } + const didChange = leftChange || rightChange; if ( didChange ) { diff --git a/src/castFunctions.js b/src/castFunctions.js index e0b4519ff..a5d126977 100644 --- a/src/castFunctions.js +++ b/src/castFunctions.js @@ -183,7 +183,7 @@ export const shapecast = ( function () { const offset = uint32Array[ nodeIndex32 + 6 ]; const count = uint16Array[ nodeIndex16 + 14 ]; - return intersectsRangeFunc( offset, count, false, depth ); + return intersectsRangeFunc( offset, count, false, depth, nodeIndex32 ); } else { @@ -230,8 +230,8 @@ export const shapecast = ( function () { } - const isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); + const isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 ); let c1StopTraversal; if ( c1Intersection === CONTAINED ) { @@ -240,7 +240,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 ); } else { @@ -268,8 +268,8 @@ export const shapecast = ( function () { box2 = cachedBox2; arrayToBox( c2, float32Array, box2 ); - const isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); + const isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 ); let c2StopTraversal; if ( c2Intersection === CONTAINED ) { @@ -278,7 +278,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 ); } else { diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index 2198aa438..e2672ea70 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -185,7 +185,7 @@ export const shapecast = ( function () { const offset = OFFSET( nodeIndex32 ); const count = COUNT( nodeIndex16 ); - return intersectsRangeFunc( offset, count, false, depth ); + return intersectsRangeFunc( offset, count, false, depth, nodeIndex32 ); } else { @@ -232,7 +232,7 @@ export const shapecast = ( function () { } - const isC1Leaf = IS_LEAF( c1 ); + const isC1Leaf = IS_LEAF( c1 * 2 ); const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 ); let c1StopTraversal; @@ -242,7 +242,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 ); } else { @@ -270,7 +270,7 @@ export const shapecast = ( function () { box2 = cachedBox2; arrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); - const isC2Leaf = IS_LEAF( c2 ); + const isC2Leaf = IS_LEAF( c2 * 2 ); const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 ); let c2StopTraversal; @@ -280,7 +280,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1 ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 ); } else { From 83b39885cb229a59743097c6072703f6238865b9 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 17:20:42 -0800 Subject: [PATCH 127/139] refit update --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75057e0b1..a56aeaec5 100644 --- a/README.md +++ b/README.md @@ -376,10 +376,52 @@ A generalized cast function that can be used to implement intersection logic for ### .refit ```js -refit( geometry : BufferGeometry ) : void +refit( + traversedNodeIndices : Array | Set = null, + endNodeIndices : Array | Set = null +) : void ``` -Refit the node bounds to the current triangle positions. This is quicker than regenerating a new BVH but will not be optimal after significant changes to the vertices. +Refit the node bounds to the current triangle positions. This is quicker than regenerating a new BVH but will not be optimal after significant changes to the vertices. `traversedNodeIndices` is a set of node indices (provided by the [shapecast](#shapecast) function) that need to be refit including all internal nodes. `endNodeIndices` is the set of nodes that traversal ended at and that triangles need to be updated for. If neither index set is provided then the whole BVH is updated which is significantly slower than surgically updating the nodes that need to be updated. + +Here's how to get the set of indices that need to be refit: + +```js +const traversedNodeIndices = new Set(); +const endNodeIndices = new Set(); +bvh.shapecast( + + mesh, + { + + intersectsBounds: ( box, isLeaf, score, depth, nodeIndex ) => { + + if ( /* intersects shape */ ) { + + traversedNodeIndices.add( nodeIndex ); + return INTERSECTED; + + } + + return NOT_INTERSECTED; + + }, + + intersectsRange: ( offset, count, contained, depth, nodeIndex ) => { + + // collect triangles to update + endNodeIndices.add( nodeIndex ); + + } + + } + +); + +// update the positions of the triangle vertices + +bvh.refit( traversedNodeIndices, endNodeIndices ); +``` ### .getBoundingBox From 0dc0478c04d8f2916e989589614b036583e12a57 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 17:43:39 -0800 Subject: [PATCH 128/139] README update, fix collect triangles brush --- README.md | 3 ++- example/collectTriangles.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a56aeaec5..f3cf27d3f 100644 --- a/README.md +++ b/README.md @@ -343,7 +343,8 @@ shapecast( triangleOffset : Number, triangleCount : Number contained : Boolean, - depth : Number + depth : Number, + nodeIndex : Number ) => Boolean = null, intersectsTriangle : ( diff --git a/example/collectTriangles.js b/example/collectTriangles.js index ab0d71c66..b61c14aad 100644 --- a/example/collectTriangles.js +++ b/example/collectTriangles.js @@ -105,6 +105,7 @@ function init() { mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; + brushActive = true; } ); From 7b04f039f80bfafcc852369643693ee5adc74f25 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 17:44:23 -0800 Subject: [PATCH 129/139] sculpt example fast refit --- example/sculpt.js | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index 20032cd2a..baa86caea 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -225,6 +225,7 @@ function init() { mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; + brushActive = true; } ); @@ -302,7 +303,14 @@ function init() { } // Run the perform the brush movement -function performStroke( point, brushObject, brushOnly = false, accumulatedTriangles = new Set(), accumulatedIndices = new Set() ) { +function performStroke( point, brushObject, brushOnly = false, accumulatedFields = {} ) { + + const { + accumulatedTriangles = new Set(), + accumulatedIndices = new Set(), + accumulatedTraversedNodeIndices = new Set(), + accumulatedEndNodeIndices = new Set(), + } = accumulatedFields; const inverseMatrix = new THREE.Matrix4(); inverseMatrix.copy( targetMesh.matrixWorld ).invert(); @@ -324,7 +332,9 @@ function performStroke( point, brushObject, brushOnly = false, accumulatedTriang targetMesh, { - intersectsBounds: box => { + intersectsBounds: ( box, isLeaf, score, depth, nodeIndex ) => { + + accumulatedTraversedNodeIndices.add( nodeIndex ); const intersects = sphere.intersectsBox( box ); const { min, max } = box; @@ -361,6 +371,12 @@ function performStroke( point, brushObject, brushOnly = false, accumulatedTriang }, + intersectsRange: ( offset, count, contained, depth, nodeIndex ) => { + + accumulatedEndNodeIndices.add( nodeIndex ); + + }, + intersectsTriangle: ( tri, index, contained ) => { const triIndex = index; @@ -644,6 +660,16 @@ function render() { // refitting of the model const changedTriangles = new Set(); const changedIndices = new Set(); + const traversedNodeIndices = new Set(); + const endNodeIndices = new Set(); + const sets = { + + accumulatedTriangles: changedTriangles, + accumulatedIndices: changedIndices, + accumulatedTraversedNodeIndices: traversedNodeIndices, + accumulatedEndNodeIndices: endNodeIndices, + + }; while ( castDist > step && mdist > params.size * 200 / hit.distance ) { lastMouse.lerp( mouse, percent ); @@ -651,12 +677,12 @@ function render() { castDist -= step; mdist -= mstep; - performStroke( lastCastPose, brush, false, changedTriangles, changedIndices ); + performStroke( lastCastPose, brush, false, sets ); if ( params.symmetrical ) { lastCastPose.x *= - 1; - performStroke( lastCastPose, symmetryBrush, false, changedTriangles, changedIndices ); + performStroke( lastCastPose, symmetryBrush, false, sets ); lastCastPose.x *= - 1; } @@ -677,7 +703,7 @@ function render() { // so it's up to date for the next one because both of those are used when updating // the model but it's faster to do them here. updateNormals( changedTriangles, changedIndices ); - targetMesh.geometry.boundsTree.refit(); + targetMesh.geometry.boundsTree.refit( traversedNodeIndices, endNodeIndices ); if ( bvhHelper.parent !== null ) { From 5027285e7916471591819966637d2c474b79e17f Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 17:56:24 -0800 Subject: [PATCH 130/139] Fix shapecast --- example/sculpt.js | 2 +- src/MeshBVH.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/sculpt.js b/example/sculpt.js index baa86caea..14c9cc2e0 100644 --- a/example/sculpt.js +++ b/example/sculpt.js @@ -699,7 +699,7 @@ function render() { // refit the bounds and update the normals if we adjusted the mesh if ( stepCount > 0 ) { - // TODO: refit bounds and normal updates should probably happen after every stroke + // refit bounds and normal updates could happen after every stroke // so it's up to date for the next one because both of those are used when updating // the model but it's faster to do them here. updateNormals( changedTriangles, changedIndices ); diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 89f7ea905..37f643254 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -398,9 +398,9 @@ export default class MeshBVH { if ( intersectsRange && intersectsTriangle ) { const originalIntersectsRange = intersectsRange; - intersectsRange = ( offset, count, contained, depth ) => { + intersectsRange = ( offset, count, contained, depth, nodeIndex ) => { - if ( ! originalIntersectsRange( offset, count, contained, depth ) ) { + if ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) { return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); From ba464b8a7d5fe9d495325036d12c2eccf86fff04 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 12 Mar 2021 18:33:35 -0800 Subject: [PATCH 131/139] npm run build --- example/bundle/asyncGenerate.4a48c6e8.js | 8 +- example/bundle/asyncGenerate.html | 3 +- example/bundle/characterMovement.725f956b.js | 10 +- example/bundle/collectTriangles.9c45819a.js | 10 +- example/bundle/collectTriangles.html | 3 +- example/bundle/distancecast.4107d8f2.js | 8 +- example/bundle/distancecast.html | 3 +- .../bundle/generateAsync.worker.13d14241.js | 8 +- example/bundle/physics.50b811f1.js | 10 +- example/bundle/randomSampleDebug.32ad2b43.js | 8 +- example/bundle/raycast.88074831.js | 8 +- example/bundle/raycast.html | 3 +- example/bundle/sculpt.493e9c78.js | 10 +- example/bundle/selection.383a520f.js | 10 +- example/bundle/shapecast.b93a7fe2.js | 8 +- src/MeshBVH.js | 1 - umd/index.js | 387 ++++++++++++------ umd/index.js.map | 2 +- 18 files changed, 316 insertions(+), 184 deletions(-) diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index abf786eaf..5cf598b64 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -28,11 +28,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var o=this.worker;return this.running=!0,new Promise(function(a,u){o.onmessage=function(s){t.running=!1,o.onmessage=null;var f=s.data,l=f.serialized,d=f.position,c=f.error;if(c)u(new Error(c));else{var h=r.default.deserialize(l,n,!1),g=Object.assign({setBoundingBox:!0},i);n.attributes.position.array=d,n.index&&(n.index.array=l.index),g.setBoundingBox&&(n.boundingBox=h.getBoundingBox(new e.Box3)),a(h)}};var s=n.index?n.index.array:null,f=n.attributes.position.array;if(f.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var l=[f];s&&l.push(s),o.postMessage({index:s,position:f,options:i},l.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),n}();exports.GenerateMeshBVHWorker=a; },{"three":"dKqR","../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { diff --git a/example/bundle/asyncGenerate.html b/example/bundle/asyncGenerate.html index c05dcda16..079691e54 100644 --- a/example/bundle/asyncGenerate.html +++ b/example/bundle/asyncGenerate.html @@ -1,2 +1 @@ -THREE.js BVH Geometry Collect Triangles
- \ No newline at end of file +THREE.js BVH Geometry Collect Triangles
\ No newline at end of file diff --git a/example/bundle/characterMovement.725f956b.js b/example/bundle/characterMovement.725f956b.js index a680b2b55..731011ac5 100644 --- a/example/bundle/characterMovement.725f956b.js +++ b/example/bundle/characterMovement.725f956b.js @@ -36,11 +36,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iMath.abs(e*C.y*.25))?C.set(0,0,0):(i.normalize(),C.addScaledVector(i,-i.dot(C))),u.position.sub(x.target),x.target.copy(S.position),u.position.add(S.position),S.position.y<-25&&H()}function F(){h.update(),requestAnimationFrame(F);var e=Math.min(w.getDelta(),.1);if(b.firstPerson?(x.maxPolarAngle=Math.PI,x.minDistance=1e-4,x.maxDistance=1e-4):(x.maxPolarAngle=Math.PI/2,x.minDistance=1,x.maxDistance=20),g){g.visible=b.displayCollider,v.visible=b.displayBVH;for(var t=b.physicsSteps,a=0;aMath.abs(e*C.y*.25))?C.set(0,0,0):(i.normalize(),C.addScaledVector(i,-i.dot(C))),u.position.sub(x.target),x.target.copy(S.position),u.position.add(S.position),S.position.y<-25&&H()}function F(){h.update(),requestAnimationFrame(F);var e=Math.min(w.getDelta(),.1);if(b.firstPerson?(x.maxPolarAngle=Math.PI,x.minDistance=1e-4,x.maxDistance=1e-4):(x.maxPolarAngle=Math.PI/2,x.minDistance=1,x.maxDistance=20),g){g.visible=b.displayCollider,v.visible=b.displayBVH;for(var t=b.physicsSteps,a=0;a=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iTHREE.js BVH Geometry Collect Triangles - \ No newline at end of file +THREE.js BVH Geometry Collect Triangles \ No newline at end of file diff --git a/example/bundle/distancecast.4107d8f2.js b/example/bundle/distancecast.4107d8f2.js index 3e3b36fdc..6fa950ca8 100644 --- a/example/bundle/distancecast.4107d8f2.js +++ b/example/bundle/distancecast.4107d8f2.js @@ -561,11 +561,11 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return tTHREE.js BVH Geometry Closest Distance
- \ No newline at end of file +THREE.js BVH Geometry Closest Distance
\ No newline at end of file diff --git a/example/bundle/generateAsync.worker.13d14241.js b/example/bundle/generateAsync.worker.13d14241.js index 9fc13a509..43d4657df 100644 --- a/example/bundle/generateAsync.worker.13d14241.js +++ b/example/bundle/generateAsync.worker.13d14241.js @@ -23,11 +23,11 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i2)){c.x=e.clientX/window.innerWidth*2-1,c.y=-e.clientY/window.innerHeight*2+1,s.setFromCamera(c,p);var t=L();t.position.copy(p.position).addScaledVector(s.ray.direction,3),t.velocity.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).addScaledVector(s.ray.direction,10*Math.random()+15).multiplyScalar(.5)}}),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.createSphere=L}function z(){(new t.GLTFLoader).load("../models/low_poly_environment_jungle_scene/scene.gltf",function(t){(f=t.scene).scale.setScalar(.05);var a=new e.PointLight(65535);a.distance=7,a.position.set(-100,-40,100),f.add(a);var i=new e.PointLight(16768358);i.distance=15,i.intensity=5,i.position.set(80,80,135),i.shadow.normalBias=.01,i.shadow.bias=-.001,i.shadow.mapSize.setScalar(1024),i.castShadow=!0,f.add(i);var o=[];f.updateMatrixWorld(!0),f.traverse(function(e){if(e.geometry){var t=e.geometry.clone();for(var a in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==a&&t.deleteAttribute(a);o.push(t)}});var d=r.BufferGeometryUtils.mergeBufferGeometries(o,!1);d.boundsTree=new n.MeshBVH(d,{lazyGeneration:!1}),(w=new e.Mesh(d)).material.wireframe=!0,w.material.opacity=.5,w.material.transparent=!0,y=new n.MeshBVHVisualizer(w,S.visualizeDepth),u.add(y),u.add(w),u.add(f),f.traverse(function(e){e.material&&(e.castShadow=!0,e.receiveShadow=!0,e.material.shadowSide=2)})})}function C(t,a,r,i,o){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(oH.dot(v.velocity)?(F=.5*O*(W-E)/(W+E),q=.5*O*2*W/(W+E),F-=O):(F=.5*O*2*E/(W+E),q=.5*O*(E-W)/(W+E),q-=O),H.normalize(),p.velocity.addScaledVector(H,F),v.velocity.addScaledVector(H,q),x.copy(h.center).addScaledVector(b,-h.radius),C(p,v,x,b,O,0)}}p.position.copy(h.center)}}function G(){M.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),M.length=0,g.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),g.length=0}function H(){var t=new e.Vector3;M.forEach(function(e){t.copy(e.position),t.y+=10,t.normalize(),e.velocity.addScaledVector(t,120)})}function O(e){if(w)for(var t=S.physicsSteps,a=0;a=1&&(g.splice(r,1),o.parent.remove(o),o.geometry.dispose(),o.material.dispose(),r--,i--)}}function W(){v.update(),requestAnimationFrame(W);var e=Math.min(h.getDelta(),.1);w&&(w.visible=S.displayCollider,y.visible=S.displayBVH,S.pause||O(S.simulationSpeed*e)),l.render(u,p)}j(),W(); +"use strict";var e=c(require("three")),t=require("three/examples/jsm/loaders/GLTFLoader.js"),a=require("three/examples/jsm/controls/OrbitControls.js"),r=require("three/examples/jsm/utils/BufferGeometryUtils.js"),i=d(require("stats.js")),o=require("dat.gui"),n=require("../src/index.js");function d(e){return e&&e.__esModule?e:{default:e}}function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function c(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(a,i,o):a[i]=e[i]}return a.default=e,t&&t.set(e,a),a}var l,p,u,h,m,v,f,w,y,S={displayCollider:!1,displayBVH:!1,visualizeDepth:10,gravity:-9.8,physicsSteps:5,simulationSpeed:1,sphereSize:1,pause:!1,step:function(){for(var e=S.physicsSteps,t=0;t2)){c.x=e.clientX/window.innerWidth*2-1,c.y=-e.clientY/window.innerHeight*2+1,s.setFromCamera(c,p);var t=B();t.position.copy(p.position).addScaledVector(s.ray.direction,3),t.velocity.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).addScaledVector(s.ray.direction,10*Math.random()+15).multiplyScalar(.5)}}),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.createSphere=B}function z(){(new t.GLTFLoader).load("../models/low_poly_environment_jungle_scene/scene.gltf",function(t){(f=t.scene).scale.setScalar(.05);var a=new e.PointLight(65535);a.distance=7,a.position.set(-100,-40,100),f.add(a);var i=new e.PointLight(16768358);i.distance=15,i.intensity=5,i.position.set(80,80,135),i.shadow.normalBias=.01,i.shadow.bias=-.001,i.shadow.mapSize.setScalar(1024),i.castShadow=!0,f.add(i);var o=[];f.updateMatrixWorld(!0),f.traverse(function(e){if(e.geometry){var t=e.geometry.clone();for(var a in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==a&&t.deleteAttribute(a);o.push(t)}});var d=r.BufferGeometryUtils.mergeBufferGeometries(o,!1);d.boundsTree=new n.MeshBVH(d,{lazyGeneration:!1}),(w=new e.Mesh(d)).material.wireframe=!0,w.material.opacity=.5,w.material.transparent=!0,y=new n.MeshBVHVisualizer(w,S.visualizeDepth),u.add(y),u.add(w),u.add(f),f.traverse(function(e){e.material&&(e.castShadow=!0,e.receiveShadow=!0,e.material.shadowSide=2)})})}function C(t,a,r,i,o){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(oG.dot(v.velocity)?(F=.5*H*(W-E)/(W+E),q=.5*H*2*W/(W+E),F-=H):(F=.5*H*2*E/(W+E),q=.5*H*(E-W)/(W+E),q-=H),G.normalize(),p.velocity.addScaledVector(G,F),v.velocity.addScaledVector(G,q),x.copy(h.center).addScaledVector(b,-h.radius),C(p,v,x,b,H,0)}}p.position.copy(h.center)}}function O(){g.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),g.length=0,M.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),M.length=0}function G(){var t=new e.Vector3;g.forEach(function(e){t.copy(e.position),t.y+=10,t.normalize(),e.velocity.addScaledVector(t,120)})}function H(e){if(w)for(var t=S.physicsSteps,a=0;a=1&&(M.splice(r,1),o.parent.remove(o),o.geometry.dispose(),o.material.dispose(),r--,i--)}}function W(){v.update(),requestAnimationFrame(W);var e=Math.min(h.getDelta(),.1);w&&(w.visible=S.displayCollider,y.visible=S.displayBVH,S.pause||H(S.simulationSpeed*e)),l.render(u,p)}j(),W(); },{"three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","stats.js":"dnrf","dat.gui":"KkZG","../src/index.js":"uBxZ"}]},{},["UoLN"], null) \ No newline at end of file diff --git a/example/bundle/randomSampleDebug.32ad2b43.js b/example/bundle/randomSampleDebug.32ad2b43.js index f130fb257..d393d8d9b 100644 --- a/example/bundle/randomSampleDebug.32ad2b43.js +++ b/example/bundle/randomSampleDebug.32ad2b43.js @@ -23,11 +23,11 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return tTHREE.js BVH Geometry Raycasting - \ No newline at end of file +THREE.js BVH Geometry Raycasting \ No newline at end of file diff --git a/example/bundle/sculpt.493e9c78.js b/example/bundle/sculpt.493e9c78.js index ac3cab2e7..6771c722c 100644 --- a/example/bundle/sculpt.493e9c78.js +++ b/example/bundle/sculpt.493e9c78.js @@ -557,11 +557,11 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Set,n=new l.Matrix4;n.copy(i.matrixWorld).invert();var u=new l.Sphere;u.center.copy(e).applyMatrix4(n),u.radius=z.size;var a=new Set,d=new l.Vector3,c=new l.Vector3,m=i.geometry.index,p=i.geometry.attributes.position,f=i.geometry.attributes.normal,q=new Set;i.geometry.boundsTree.shapecast(i,function(e){var r=u.intersectsBox(e),s=e.min,t=e.max;if(r){for(var o=0;o<=1;o++)for(var i=0;i<=1;i++)for(var n=0;n<=1;n++)if(d.set(0===o?s.x:t.x,0===i?s.y:t.y,0===n?s.z:t.z),!u.containsPoint(d))return j.INTERSECTED;return j.CONTAINED}return r?j.INTERSECTED:j.NOT_INTERSECTED},function(e,r,s,i,n){var d=~~(r/3);q.add(d),t.add(d);var c=m.getX(r),l=m.getX(s),p=m.getX(i);return n?(a.add(c),a.add(l),a.add(p),o.add(c),o.add(l),o.add(p)):(u.containsPoint(e.a)&&(a.add(c),o.add(c)),u.containsPoint(e.b)&&(a.add(l),o.add(l)),u.containsPoint(e.c)&&(a.add(p),o.add(p))),!1});var y=new l.Vector3;y.copy(e).applyMatrix4(n);var g=new l.Vector3,w=0;if(a.forEach(function(e){d.fromBufferAttribute(f,e),c.add(d),s||(w++,d.fromBufferAttribute(p,e),g.add(d))}),c.normalize(),r.quaternion.setFromUnitVectors(h,c),w&&g.multiplyScalar(1/w),!s){var b=1e-4*z.intensity,v=new l.Plane;v.setFromNormalAndCoplanarPoint(c,g),a.forEach(function(e){d.fromBufferAttribute(p,e);var r=d.distanceTo(y),s=z.invert?-1:1,t=1-r/z.size;if("clay"===z.brush){t=Math.pow(t,3);var o=v.distanceToPoint(d),i=s*Math.min(4*t,1);d.addScaledVector(c,i*b-s*o*i*.3)}else if("normal"===z.brush)t=Math.pow(t,2),d.addScaledVector(c,s*t*b);else if("flatten"===z.brush){t=Math.pow(t,2);var n=v.distanceToPoint(d);d.addScaledVector(c,-n*t*z.intensity*.01*.5)}p.setXYZ(e,d.x,d.y,d.z),f.setXYZ(e,0,0,0)}),a.size&&(p.needsUpdate=!0)}}function V(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function T(){if(requestAnimationFrame(T),e.begin(),o.active||!w)n.visible=!1,u.visible=!1,M.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(b,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(z.size,z.size,.1),n.position.copy(c.point),u.visible=z.symmetrical,u.scale.set(z.size,z.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,M.x===1/0&&M.copy(c.point),x||B){for(var m=(b.x-v.x)*window.innerWidth*window.devicePixelRatio,p=(b.y-v.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(M),q=.15*z.size,y=Math.max(q/f,1/z.maxSteps),g=j*y,h=0,S=new Set,E=new Set;f>q&&j>200*z.size/c.distance&&(v.lerp(b,y),M.lerp(c.point,y),f-=q,j-=g,P(M,n,!1,S,E),z.symmetrical&&(M.x*=-1,P(M,u,!1,S,E),M.x*=-1),!(++h>z.maxSteps)););h>0?(V(S,E),i.geometry.boundsTree.refit(),a.update()):(P(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,P(c.point,u,!0),c.point.x*=-1))}else P(c.point,n,!0),z.symmetrical&&(c.point.x*=-1,P(c.point,u,!0),c.point.x*=-1),v.copy(b),M.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,v.copy(b),M.setScalar(1/0)}B=x,t.render(r,s),e.end()}E(),T(); +"use strict";require("core-js/modules/es6.array.copy-within"),require("core-js/modules/es6.array.fill"),require("core-js/modules/es6.array.find"),require("core-js/modules/es6.array.find-index"),require("core-js/modules/es7.array.flat-map"),require("core-js/modules/es6.array.from"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.array.iterator"),require("core-js/modules/es6.array.of"),require("core-js/modules/es6.array.sort"),require("core-js/modules/es6.array.species"),require("core-js/modules/es6.date.to-json"),require("core-js/modules/es6.date.to-primitive"),require("core-js/modules/es6.function.has-instance"),require("core-js/modules/es6.function.name"),require("core-js/modules/es6.map"),require("core-js/modules/es6.math.acosh"),require("core-js/modules/es6.math.asinh"),require("core-js/modules/es6.math.atanh"),require("core-js/modules/es6.math.cbrt"),require("core-js/modules/es6.math.clz32"),require("core-js/modules/es6.math.cosh"),require("core-js/modules/es6.math.expm1"),require("core-js/modules/es6.math.fround"),require("core-js/modules/es6.math.hypot"),require("core-js/modules/es6.math.imul"),require("core-js/modules/es6.math.log1p"),require("core-js/modules/es6.math.log10"),require("core-js/modules/es6.math.log2"),require("core-js/modules/es6.math.sign"),require("core-js/modules/es6.math.sinh"),require("core-js/modules/es6.math.tanh"),require("core-js/modules/es6.math.trunc"),require("core-js/modules/es6.number.constructor"),require("core-js/modules/es6.number.epsilon"),require("core-js/modules/es6.number.is-finite"),require("core-js/modules/es6.number.is-integer"),require("core-js/modules/es6.number.is-nan"),require("core-js/modules/es6.number.is-safe-integer"),require("core-js/modules/es6.number.max-safe-integer"),require("core-js/modules/es6.number.min-safe-integer"),require("core-js/modules/es6.number.parse-float"),require("core-js/modules/es6.number.parse-int"),require("core-js/modules/es6.object.assign"),require("core-js/modules/es7.object.define-getter"),require("core-js/modules/es7.object.define-setter"),require("core-js/modules/es7.object.entries"),require("core-js/modules/es6.object.freeze"),require("core-js/modules/es6.object.get-own-property-descriptor"),require("core-js/modules/es7.object.get-own-property-descriptors"),require("core-js/modules/es6.object.get-own-property-names"),require("core-js/modules/es6.object.get-prototype-of"),require("core-js/modules/es7.object.lookup-getter"),require("core-js/modules/es7.object.lookup-setter"),require("core-js/modules/es6.object.prevent-extensions"),require("core-js/modules/es6.object.to-string"),require("core-js/modules/es6.object.is"),require("core-js/modules/es6.object.is-frozen"),require("core-js/modules/es6.object.is-sealed"),require("core-js/modules/es6.object.is-extensible"),require("core-js/modules/es6.object.keys"),require("core-js/modules/es6.object.seal"),require("core-js/modules/es6.object.set-prototype-of"),require("core-js/modules/es7.object.values"),require("core-js/modules/es6.promise"),require("core-js/modules/es7.promise.finally"),require("core-js/modules/es6.reflect.apply"),require("core-js/modules/es6.reflect.construct"),require("core-js/modules/es6.reflect.define-property"),require("core-js/modules/es6.reflect.delete-property"),require("core-js/modules/es6.reflect.get"),require("core-js/modules/es6.reflect.get-own-property-descriptor"),require("core-js/modules/es6.reflect.get-prototype-of"),require("core-js/modules/es6.reflect.has"),require("core-js/modules/es6.reflect.is-extensible"),require("core-js/modules/es6.reflect.own-keys"),require("core-js/modules/es6.reflect.prevent-extensions"),require("core-js/modules/es6.reflect.set"),require("core-js/modules/es6.reflect.set-prototype-of"),require("core-js/modules/es6.regexp.constructor"),require("core-js/modules/es6.regexp.flags"),require("core-js/modules/es6.regexp.match"),require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es6.regexp.split"),require("core-js/modules/es6.regexp.search"),require("core-js/modules/es6.regexp.to-string"),require("core-js/modules/es6.set"),require("core-js/modules/es6.symbol"),require("core-js/modules/es7.symbol.async-iterator"),require("core-js/modules/es6.string.anchor"),require("core-js/modules/es6.string.big"),require("core-js/modules/es6.string.blink"),require("core-js/modules/es6.string.bold"),require("core-js/modules/es6.string.code-point-at"),require("core-js/modules/es6.string.ends-with"),require("core-js/modules/es6.string.fixed"),require("core-js/modules/es6.string.fontcolor"),require("core-js/modules/es6.string.fontsize"),require("core-js/modules/es6.string.from-code-point"),require("core-js/modules/es6.string.includes"),require("core-js/modules/es6.string.italics"),require("core-js/modules/es6.string.iterator"),require("core-js/modules/es6.string.link"),require("core-js/modules/es7.string.pad-start"),require("core-js/modules/es7.string.pad-end"),require("core-js/modules/es6.string.raw"),require("core-js/modules/es6.string.repeat"),require("core-js/modules/es6.string.small"),require("core-js/modules/es6.string.starts-with"),require("core-js/modules/es6.string.strike"),require("core-js/modules/es6.string.sub"),require("core-js/modules/es6.string.sup"),require("core-js/modules/es7.string.trim-left"),require("core-js/modules/es7.string.trim-right"),require("core-js/modules/es6.typed.array-buffer"),require("core-js/modules/es6.typed.int8-array"),require("core-js/modules/es6.typed.uint8-array"),require("core-js/modules/es6.typed.uint8-clamped-array"),require("core-js/modules/es6.typed.int16-array"),require("core-js/modules/es6.typed.uint16-array"),require("core-js/modules/es6.typed.int32-array"),require("core-js/modules/es6.typed.uint32-array"),require("core-js/modules/es6.typed.float32-array"),require("core-js/modules/es6.typed.float64-array"),require("core-js/modules/es6.weak-map"),require("core-js/modules/es6.weak-set"),require("core-js/modules/web.timers"),require("core-js/modules/web.immediate"),require("core-js/modules/web.dom.iterable"),require("regenerator-runtime/runtime");var e,r,s,t,o,i,n,u,a,d=y(require("stats.js/src/Stats")),c=q(require("dat.gui")),l=q(require("three")),m=require("three/examples/jsm/controls/OrbitControls.js"),p=require("three/examples/jsm/utils/BufferGeometryUtils.js"),j=require("../src/index.js");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function q(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=f();if(r&&r.has(e))return r.get(e);var s={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=t?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(s,o,i):s[o]=e[o]}return s.default=e,r&&r.set(e,s),s}function y(e){return e&&e.__esModule?e:{default:e}}l.Mesh.prototype.raycast=j.acceleratedRaycast,l.BufferGeometry.prototype.computeBoundsTree=j.computeBoundsTree,l.BufferGeometry.prototype.disposeBoundsTree=j.disposeBoundsTree;var g,w=new l.Vector3(0,0,1),h=!1,b=new l.Vector2,v=new l.Vector2,x=!1,S=!1,B=new l.Vector3,M={size:.1,brush:"clay",intensity:50,maxSteps:10,invert:!1,symmetrical:!0,flatShading:!1,depth:10,displayHelper:!1};function z(){i&&(i.geometry.dispose(),i.material.dispose(),r.remove(i)),g||(g=(new l.TextureLoader).load("../textures/skinHazardousarts2.jpg"));var e=new l.IcosahedronBufferGeometry(1,100);e.deleteAttribute("uv"),(e=p.BufferGeometryUtils.mergeVertices(e)).attributes.position.setUsage(l.DynamicDrawUsage),e.attributes.normal.setUsage(l.DynamicDrawUsage),e.computeBoundsTree({setBoundingBox:!1}),(i=new l.Mesh(e,new l.MeshMatcapMaterial({flatShading:M.flatShading,matcap:g}))).material.matcap.encoding=l.sRGBEncoding,i.frustumCulled=!1,r.add(i),a||(a=new j.MeshBVHVisualizer(i,M.depth),M.displayHelper&&r.add(a)),a.mesh=i,a.update()}function E(){(t=new l.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),t.setClearColor(1251612,1),t.gammaOutput=!0,document.body.appendChild(t.domElement),t.domElement.style.touchAction="none",(r=new l.Scene).fog=new l.Fog(1251612,20,60);var p=new l.DirectionalLight(16777215,.5);p.position.set(1,1,1),r.add(p),r.add(new l.AmbientLight(16777215,.4)),z();for(var j=[new l.Vector3,new l.Vector3(0,0,1)],f=0;f<50;f++){var q=f+1,y=Math.sin(2*Math.PI*f/50),g=Math.cos(2*Math.PI*f/50),w=Math.sin(2*Math.PI*q/50),v=Math.cos(2*Math.PI*q/50);j.push(new l.Vector3(y,g,0),new l.Vector3(w,v,0))}(n=new l.LineSegments).geometry.setFromPoints(j),n.material.color.set(16485376),r.add(n),u=n.clone(),r.add(u),(s=new l.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,3),s.far=100,s.updateProjectionMatrix(),e=new d.default,document.body.appendChild(e.dom);var S=new c.GUI,B=S.addFolder("Sculpting");B.add(M,"brush",["normal","clay","flatten"]),B.add(M,"size").min(.025).max(.25).step(.005),B.add(M,"intensity").min(1).max(100).step(1),B.add(M,"maxSteps").min(1).max(25).step(1),B.add(M,"symmetrical"),B.add(M,"invert"),B.add(M,"flatShading").onChange(function(e){i.material.flatShading=e,i.material.needsUpdate=!0}),B.open();var E=S.addFolder("BVH Helper");E.add(M,"depth").min(1).max(20).step(1).onChange(function(e){a.depth=parseFloat(e),a.update()}),E.add(M,"displayHelper").onChange(function(e){e?(r.add(a),a.update()):r.remove(a)}),E.open(),S.add({reset:z},"reset"),S.add({rebuildBVH:function(){i.geometry.computeBoundsTree({setBoundingBox:!1}),a.update()}},"rebuildBVH"),S.open(),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("pointermove",function(e){b.x=e.clientX/window.innerWidth*2-1,b.y=-e.clientY/window.innerHeight*2+1,h=!0}),window.addEventListener("pointerdown",function(e){b.x=e.clientX/window.innerWidth*2-1,b.y=-e.clientY/window.innerHeight*2+1,x=Boolean(1&e.buttons),h=!0;var r=new l.Raycaster;r.setFromCamera(b,s),r.firstHitOnly=!0;var t=r.intersectObject(i);o.enabled=0===t.length},!0),window.addEventListener("pointerup",function(e){x=Boolean(1&e.buttons),"touch"===e.pointerType&&(h=!1)}),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),M.size+=1e-4*r,M.size=Math.max(Math.min(M.size,.25),.025),S.updateDisplay()}),(o=new m.OrbitControls(s,t.domElement)).minDistance=1.5,o.addEventListener("start",function(){this.active=!0}),o.addEventListener("end",function(){this.active=!1})}function T(e,r){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.accumulatedTriangles,n=void 0===o?new Set:o,u=t.accumulatedIndices,a=void 0===u?new Set:u,d=t.accumulatedTraversedNodeIndices,c=void 0===d?new Set:d,m=t.accumulatedEndNodeIndices,p=void 0===m?new Set:m,f=new l.Matrix4;f.copy(i.matrixWorld).invert();var q=new l.Sphere;q.center.copy(e).applyMatrix4(f),q.radius=M.size;var y=new Set,g=new l.Vector3,h=new l.Vector3,b=i.geometry.index,v=i.geometry.attributes.position,x=i.geometry.attributes.normal,S=new Set;i.geometry.boundsTree.shapecast(i,{intersectsBounds:function(e,r,s,t,o){c.add(o);var i=q.intersectsBox(e),n=e.min,u=e.max;if(i){for(var a=0;a<=1;a++)for(var d=0;d<=1;d++)for(var l=0;l<=1;l++)if(g.set(0===a?n.x:u.x,0===d?n.y:u.y,0===l?n.z:u.z),!q.containsPoint(g))return j.INTERSECTED;return j.CONTAINED}return i?j.INTERSECTED:j.NOT_INTERSECTED},intersectsRange:function(e,r,s,t,o){p.add(o)},intersectsTriangle:function(e,r,s){var t=r;S.add(t),n.add(t);var o=3*r,i=o+0,u=o+1,d=o+2,c=b.getX(i),l=b.getX(u),m=b.getX(d);return s?(y.add(c),y.add(l),y.add(m),a.add(c),a.add(l),a.add(m)):(q.containsPoint(e.a)&&(y.add(c),a.add(c)),q.containsPoint(e.b)&&(y.add(l),a.add(l)),q.containsPoint(e.c)&&(y.add(m),a.add(m))),!1}});var B=new l.Vector3;B.copy(e).applyMatrix4(f);var z=new l.Vector3,E=0;if(y.forEach(function(e){g.fromBufferAttribute(x,e),h.add(g),s||(E++,g.fromBufferAttribute(v,e),z.add(g))}),h.normalize(),r.quaternion.setFromUnitVectors(w,h),E&&z.multiplyScalar(1/E),!s){var T=1e-4*M.intensity,P=new l.Plane;P.setFromNormalAndCoplanarPoint(h,z),y.forEach(function(e){g.fromBufferAttribute(v,e);var r=g.distanceTo(B),s=M.invert?-1:1,t=1-r/M.size;if("clay"===M.brush){t=Math.pow(t,3);var o=P.distanceToPoint(g),i=s*Math.min(4*t,1);g.addScaledVector(h,i*T-s*o*i*.3)}else if("normal"===M.brush)t=Math.pow(t,2),g.addScaledVector(h,s*t*T);else if("flatten"===M.brush){t=Math.pow(t,2);var n=P.distanceToPoint(g);g.addScaledVector(h,-n*t*M.intensity*.01*.5)}v.setXYZ(e,g.x,g.y,g.z),x.setXYZ(e,0,0,0)}),y.size&&(v.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active||!h)n.visible=!1,u.visible=!1,B.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(b,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(M.size,M.size,.1),n.position.copy(c.point),u.visible=M.symmetrical,u.scale.set(M.size,M.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,B.x===1/0&&B.copy(c.point),x||S){for(var m=(b.x-v.x)*window.innerWidth*window.devicePixelRatio,p=(b.y-v.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(B),q=.15*M.size,y=Math.max(q/f,1/M.maxSteps),g=j*y,w=0,z=new Set,E=new Set,C=new Set,H=new Set,O={accumulatedTriangles:z,accumulatedIndices:E,accumulatedTraversedNodeIndices:C,accumulatedEndNodeIndices:H};f>q&&j>200*M.size/c.distance&&(v.lerp(b,y),B.lerp(c.point,y),f-=q,j-=g,T(B,n,!1,O),M.symmetrical&&(B.x*=-1,T(B,u,!1,O),B.x*=-1),!(++w>M.maxSteps)););w>0?(P(z,E),i.geometry.boundsTree.refit(C,H),null!==a.parent&&a.update()):(T(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,T(c.point,u,!0),c.point.x*=-1))}else T(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,T(c.point,u,!0),c.point.x*=-1),v.copy(b),B.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,v.copy(b),B.setScalar(1/0)}S=x,t.render(r,s),e.end()}E(),V(); },{"core-js/modules/es6.array.copy-within":"tWTB","core-js/modules/es6.array.fill":"hUQ6","core-js/modules/es6.array.find":"Qppk","core-js/modules/es6.array.find-index":"sVmK","core-js/modules/es7.array.flat-map":"I8vV","core-js/modules/es6.array.from":"RRcs","core-js/modules/es7.array.includes":"TLss","core-js/modules/es6.array.iterator":"wVEN","core-js/modules/es6.array.of":"RB6b","core-js/modules/es6.array.sort":"nrVf","core-js/modules/es6.array.species":"smn3","core-js/modules/es6.date.to-json":"Gj6n","core-js/modules/es6.date.to-primitive":"jQnQ","core-js/modules/es6.function.has-instance":"a7bX","core-js/modules/es6.function.name":"N3yi","core-js/modules/es6.map":"ioKM","core-js/modules/es6.math.acosh":"py3M","core-js/modules/es6.math.asinh":"ob11","core-js/modules/es6.math.atanh":"iUik","core-js/modules/es6.math.cbrt":"YRuK","core-js/modules/es6.math.clz32":"R2Qc","core-js/modules/es6.math.cosh":"nEse","core-js/modules/es6.math.expm1":"AmoX","core-js/modules/es6.math.fround":"vmlq","core-js/modules/es6.math.hypot":"kLut","core-js/modules/es6.math.imul":"A8J8","core-js/modules/es6.math.log1p":"qtpC","core-js/modules/es6.math.log10":"VUW8","core-js/modules/es6.math.log2":"Jo9J","core-js/modules/es6.math.sign":"mZl9","core-js/modules/es6.math.sinh":"m0zb","core-js/modules/es6.math.tanh":"Fnqw","core-js/modules/es6.math.trunc":"tiOR","core-js/modules/es6.number.constructor":"kRGG","core-js/modules/es6.number.epsilon":"DzYy","core-js/modules/es6.number.is-finite":"FuY7","core-js/modules/es6.number.is-integer":"pwRL","core-js/modules/es6.number.is-nan":"SsgJ","core-js/modules/es6.number.is-safe-integer":"qVIE","core-js/modules/es6.number.max-safe-integer":"shx2","core-js/modules/es6.number.min-safe-integer":"ifBH","core-js/modules/es6.number.parse-float":"yjyf","core-js/modules/es6.number.parse-int":"Guno","core-js/modules/es6.object.assign":"K3Jy","core-js/modules/es7.object.define-getter":"guoQ","core-js/modules/es7.object.define-setter":"HMp9","core-js/modules/es7.object.entries":"gxEP","core-js/modules/es6.object.freeze":"EO7q","core-js/modules/es6.object.get-own-property-descriptor":"nIty","core-js/modules/es7.object.get-own-property-descriptors":"BQD8","core-js/modules/es6.object.get-own-property-names":"i23Y","core-js/modules/es6.object.get-prototype-of":"ud3u","core-js/modules/es7.object.lookup-getter":"HB2g","core-js/modules/es7.object.lookup-setter":"QF5J","core-js/modules/es6.object.prevent-extensions":"llMc","core-js/modules/es6.object.to-string":"zTK3","core-js/modules/es6.object.is":"MlqR","core-js/modules/es6.object.is-frozen":"Z1rp","core-js/modules/es6.object.is-sealed":"Fckj","core-js/modules/es6.object.is-extensible":"EYbC","core-js/modules/es6.object.keys":"m9aB","core-js/modules/es6.object.seal":"GYFR","core-js/modules/es6.object.set-prototype-of":"JGjq","core-js/modules/es7.object.values":"Ltmz","core-js/modules/es6.promise":"Pjta","core-js/modules/es7.promise.finally":"l1j0","core-js/modules/es6.reflect.apply":"F0Xu","core-js/modules/es6.reflect.construct":"JlFO","core-js/modules/es6.reflect.define-property":"S841","core-js/modules/es6.reflect.delete-property":"JRlJ","core-js/modules/es6.reflect.get":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor":"zj1X","core-js/modules/es6.reflect.get-prototype-of":"d0aC","core-js/modules/es6.reflect.has":"OWTq","core-js/modules/es6.reflect.is-extensible":"deHu","core-js/modules/es6.reflect.own-keys":"e6SV","core-js/modules/es6.reflect.prevent-extensions":"BmyK","core-js/modules/es6.reflect.set":"K46i","core-js/modules/es6.reflect.set-prototype-of":"L5z5","core-js/modules/es6.regexp.constructor":"BenF","core-js/modules/es6.regexp.flags":"pDhD","core-js/modules/es6.regexp.match":"RTfC","core-js/modules/es6.regexp.replace":"KGao","core-js/modules/es6.regexp.split":"aOHf","core-js/modules/es6.regexp.search":"zOab","core-js/modules/es6.regexp.to-string":"iflU","core-js/modules/es6.set":"coyu","core-js/modules/es6.symbol":"uVn9","core-js/modules/es7.symbol.async-iterator":"DlMC","core-js/modules/es6.string.anchor":"USd7","core-js/modules/es6.string.big":"c1D0","core-js/modules/es6.string.blink":"Ee86","core-js/modules/es6.string.bold":"ry39","core-js/modules/es6.string.code-point-at":"zR9y","core-js/modules/es6.string.ends-with":"zRn7","core-js/modules/es6.string.fixed":"AHLq","core-js/modules/es6.string.fontcolor":"H7V0","core-js/modules/es6.string.fontsize":"Dx83","core-js/modules/es6.string.from-code-point":"xSM3","core-js/modules/es6.string.includes":"fH7p","core-js/modules/es6.string.italics":"fRhg","core-js/modules/es6.string.iterator":"tbKg","core-js/modules/es6.string.link":"Aaz0","core-js/modules/es7.string.pad-start":"SWNE","core-js/modules/es7.string.pad-end":"n20m","core-js/modules/es6.string.raw":"t29D","core-js/modules/es6.string.repeat":"C85R","core-js/modules/es6.string.small":"qBr3","core-js/modules/es6.string.starts-with":"w2SA","core-js/modules/es6.string.strike":"eNyu","core-js/modules/es6.string.sub":"BVLK","core-js/modules/es6.string.sup":"kMsL","core-js/modules/es7.string.trim-left":"ppxd","core-js/modules/es7.string.trim-right":"hxx1","core-js/modules/es6.typed.array-buffer":"NJ0a","core-js/modules/es6.typed.int8-array":"wqMZ","core-js/modules/es6.typed.uint8-array":"QTtY","core-js/modules/es6.typed.uint8-clamped-array":"Kqgs","core-js/modules/es6.typed.int16-array":"fEGw","core-js/modules/es6.typed.uint16-array":"xyd6","core-js/modules/es6.typed.int32-array":"hIko","core-js/modules/es6.typed.uint32-array":"tNPN","core-js/modules/es6.typed.float32-array":"wisA","core-js/modules/es6.typed.float64-array":"mbTX","core-js/modules/es6.weak-map":"D6DP","core-js/modules/es6.weak-set":"bRUR","core-js/modules/web.timers":"OTsy","core-js/modules/web.immediate":"hZLH","core-js/modules/web.dom.iterable":"v6Aj","regenerator-runtime/runtime":"QVnC","stats.js/src/Stats":"RDO9","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","../src/index.js":"uBxZ"}]},{},["ODOB"], null) \ No newline at end of file diff --git a/example/bundle/selection.383a520f.js b/example/bundle/selection.383a520f.js index 9a6dcbf92..a8976723a 100644 --- a/example/bundle/selection.383a520f.js +++ b/example/bundle/selection.383a520f.js @@ -30,11 +30,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=3||Math.abs(r-H)>=3){var a=3*(b.length/3-1),i=!1;if(b.length>3)P.set(b[a-3],b[a-3+1]),W.set(b[a],b[a+1]),W.sub(P).normalize(),P.set(b[a],b[a+1]),N.set(n,o),N.sub(P).normalize(),i=W.dot(N)>.99;i?(b[a]=n,b[a+1]=o):b.push(n,o,0),T=!0,h.visible=!0,D=t,H=r,x.liveUpdate&&(O=!0)}}}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function C(){if(p.update(),requestAnimationFrame(C),y.material.wireframe=x.wireframe,w.visible=x.displayHelper,T){if("lasso"===x.toolMode){var t=b.length;b.push(b[0],b[1],b[2]),h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1)),b.length=t}else h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1));h.frustumCulled=!1,T=!1}O&&(O=!1,b.length>0&&P());var r=Math.tan(e.MathUtils.DEG2RAD*s.fov/2)*h.position.z;h.scale.set(-r*s.aspect,-r,1),l.render(u,s),x.rotate&&(M.rotation.y+=.01,x.liveUpdate&&E&&(O=!0))}S(),C();var B=new e.Matrix4,R=new Array(8).fill().map(function(){return new e.Vector3}),A=new Array(12).fill().map(function(){return new e.Line3}),D=[],H=[];function P(){for(B.copy(y.matrixWorld).premultiply(s.matrixWorldInverse).premultiply(s.projectionMatrix);D.lengths&&(s=h.y),h.xs)||!(T>s))b0?1:2}function r(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)}for(var n=1/0,o=-1,a=0,i=e.length;a=r(l,e)?-1:1:2==o?-1:1})).length,c=1;cl&&d>s)return!1;if(du&&i>c)return!1;if(in.end.y,a=0,i=t.length;ad.end.y;N(e,d,o,l)&&r++,o=l}return r}function j(e,t){function r(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}var n=e.start,o=e.end,a=t.start,i=t.end;return r(n,a,i)!==r(o,a,i)&&r(n,o,a)!==r(n,o,i)} +"use strict";var e=d(require("three")),t=a(require("stats.js")),r=require("dat.gui"),n=require("three/examples/jsm/controls/OrbitControls.js"),o=require("../src/index.js");function a(e){return e&&e.__esModule?e:{default:e}}function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}return r.default=e,t&&t.set(e,r),r}var l,s,u,c,p,f,h,y,w,v,m,g,M,x={toolMode:"lasso",selectionMode:"intersection",liveUpdate:!1,selectModel:!1,wireframe:!1,useBoundsTree:!0,displayHelper:!1,helperDepth:10,rotate:!0},b=[],E=!1,T=!1,O=!1;function S(){g=document.getElementById("output");var a=new e.Color(2503224);(l=new e.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),l.setSize(window.innerWidth,window.innerHeight),l.setClearColor(a,1),l.shadowMap.enabled=!0,l.gammaOutput=!0,document.body.appendChild(l.domElement),u=new e.Scene;var i=new e.DirectionalLight(16777215,1);i.castShadow=!0,i.shadow.mapSize.set(2048,2048),i.position.set(10,10,10),u.add(i),u.add(new e.AmbientLight(11583173,.8)),(s=new e.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(2,4,6),s.far=100,s.updateProjectionMatrix(),u.add(s),(h=new e.Line).material.color.set(16750592).convertSRGBToLinear(),h.renderOrder=1,h.position.z=-.2,h.depthTest=!1,h.scale.setScalar(1),s.add(h),M=new e.Group,u.add(M),(y=new e.Mesh(new e.TorusKnotBufferGeometry(1.5,.5,500,60).toNonIndexed(),new e.MeshStandardMaterial({polygonOffset:!0,polygonOffsetFactor:1}))).geometry.boundsTree=new o.MeshBVH(y.geometry,{lazyGeneration:!1}),y.geometry.setAttribute("color",new e.Uint8BufferAttribute(new Array(3*y.geometry.index.count).fill(255),3,!0)),y.castShadow=!0,y.receiveShadow=!0,M.add(y),w=new o.MeshBVHVisualizer(y,10),M.add(w),(v=new e.Mesh).geometry=y.geometry.clone(),v.geometry.drawRange.count=0,v.material=new e.MeshBasicMaterial({opacity:.05,transparent:!0,depthWrite:!1}),v.material.color.set(16750592).convertSRGBToLinear(),v.renderOrder=1,M.add(v),(m=new e.Mesh).geometry=v.geometry,m.material=new e.MeshBasicMaterial({opacity:.25,transparent:!0,wireframe:!0,depthWrite:!1}),m.material.color.copy(v.material.color),m.renderOrder=2,M.add(m);var d=new e.GridHelper(10,10,16777215,16777215);d.material.opacity=.2,d.material.transparent=!0,d.position.y=-2.75,u.add(d);var S=new e.Mesh(new e.PlaneBufferGeometry,new e.ShadowMaterial({color:0,opacity:.2,depthWrite:!1}));S.position.y=-2.74,S.rotation.x=-Math.PI/2,S.scale.setScalar(20),S.renderOrder=2,S.receiveShadow=!0,u.add(S),p=new t.default,document.body.appendChild(p.dom),(f=new n.OrbitControls(s,l.domElement)).minDistance=3,f.touches.ONE=e.TOUCH.PAN,f.mouseButtons.LEFT=e.MOUSE.PAN,f.touches.TWO=e.TOUCH.ROTATE,f.mouseButtons.RIGHT=e.MOUSE.ROTATE,f.enablePan=!1;var B=(c=new r.GUI).addFolder("selection");B.add(x,"toolMode",["lasso","box"]),B.add(x,"selectionMode",["centroid","intersection"]),B.add(x,"selectModel"),B.add(x,"liveUpdate"),B.add(x,"useBoundsTree"),B.open();var C=c.addFolder("display");C.add(x,"wireframe"),C.add(x,"rotate"),C.add(x,"displayHelper"),C.add(x,"helperDepth",1,30,1).onChange(function(e){w.depth=e,w.update()}),C.open(),c.open();var R=-1/0,A=-1/0,D=-1/0,H=-1/0,P=new e.Vector2,W=new e.Vector2,N=new e.Vector2;l.domElement.addEventListener("pointerdown",function(e){D=e.clientX,H=e.clientY,R=e.clientX/window.innerWidth*2-1,A=-(e.clientY/window.innerHeight*2-1),b.length=0,E=!0}),l.domElement.addEventListener("pointerup",function(){h.visible=!1,E=!1,b.length&&(O=!0)}),l.domElement.addEventListener("pointermove",function(e){if(0!=(1&e.buttons)){var t=e.clientX,r=e.clientY,n=e.clientX/window.innerWidth*2-1,o=-(e.clientY/window.innerHeight*2-1);if("box"===x.toolMode)b.length=15,b[0]=R,b[1]=A,b[2]=0,b[3]=n,b[4]=A,b[5]=0,b[6]=n,b[7]=o,b[8]=0,b[9]=R,b[10]=o,b[11]=0,b[12]=R,b[13]=A,b[14]=0,t===D&&r===H||(T=!0),D=t,H=r,h.visible=!0,x.liveUpdate&&(O=!0);else if(Math.abs(t-D)>=3||Math.abs(r-H)>=3){var a=3*(b.length/3-1),i=!1;if(b.length>3)P.set(b[a-3],b[a-3+1]),W.set(b[a],b[a+1]),W.sub(P).normalize(),P.set(b[a],b[a+1]),N.set(n,o),N.sub(P).normalize(),i=W.dot(N)>.99;i?(b[a]=n,b[a+1]=o):b.push(n,o,0),T=!0,h.visible=!0,D=t,H=r,x.liveUpdate&&(O=!0)}}}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function B(){if(p.update(),requestAnimationFrame(B),y.material.wireframe=x.wireframe,w.visible=x.displayHelper,T){if("lasso"===x.toolMode){var t=b.length;b.push(b[0],b[1],b[2]),h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1)),b.length=t}else h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1));h.frustumCulled=!1,T=!1}O&&(O=!1,b.length>0&&P());var r=Math.tan(e.MathUtils.DEG2RAD*s.fov/2)*h.position.z;h.scale.set(-r*s.aspect,-r,1),l.render(u,s),x.rotate&&(M.rotation.y+=.01,x.liveUpdate&&E&&(O=!0))}S(),B();var C=new e.Matrix4,R=new Array(8).fill().map(function(){return new e.Vector3}),A=new Array(12).fill().map(function(){return new e.Line3}),D=[],H=[];function P(){for(C.copy(y.matrixWorld).premultiply(s.matrixWorldInverse).premultiply(s.projectionMatrix);D.lengths&&(s=h.y),h.xs)||!(T>s))b0?1:2}function r(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)}for(var n=1/0,o=-1,a=0,i=e.length;a=r(l,e)?-1:1:2==o?-1:1})).length,c=1;cl&&d>s)return!1;if(du&&i>c)return!1;if(in.end.y,a=0,i=t.length;ad.end.y;N(e,d,o,l)&&r++,o=l}return r}function j(e,t){function r(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}var n=e.start,o=e.end,a=t.start,i=t.end;return r(n,a,i)!==r(o,a,i)&&r(n,o,a)!==r(n,o,i)} },{"three":"dKqR","stats.js":"dnrf","dat.gui":"KkZG","three/examples/jsm/controls/OrbitControls.js":"xTGv","../src/index.js":"uBxZ"}]},{},["jNWJ"], null) \ No newline at end of file diff --git a/example/bundle/shapecast.b93a7fe2.js b/example/bundle/shapecast.b93a7fe2.js index 1821e5365..886cf515d 100644 --- a/example/bundle/shapecast.b93a7fe2.js +++ b/example/bundle/shapecast.b93a7fe2.js @@ -560,11 +560,11 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;U?(T=r+8,w=c[r+6]):(T=c[r+6],w=r+8);var m=f(T,s,a,u)?p(T,t,n,i,a):null;if(m){var A=m.point[b];if(U?A<=s[w+h]:A>=s[w+h+3])return m}var M=f(w,s,a,u)?p(w,t,n,i,a):null;return m&&M?m.distance<=M.distance?m:M:m||M||null}var c=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,s=new r.Box3;function u(r,e,t,n,a,o,s){for(var u=t.index,l=t.attributes.position,x=3*r,p=3*(e+r);x5&&void 0!==arguments[5]?arguments[5]:null,v=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,T=arguments.length>9&&void 0!==arguments[9]?arguments[9]:s;function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*i,U=g,m=y,A=B;if(65535===m[b+15])return u(A[i+6],m[b+14],l,p,!1,v,f);var M,j,q,O,N=i+8,C=A[i+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),M=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,m=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,c,v,f,d)?!0:((0,t.arrayToBox)(m,w,s),!(!d.intersectsBox(s)||!r(m,a,c,v,f,d)))}var A=c,M=A.index,j=A.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,p),p.matrix.copy(l),p.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,function(r){return p.intersectsBox(r)},function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,n),!o.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(o.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(o.index&&o.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._roots=null,i[h]||(this._roots=(0,r.buildPackedTree)(o,i),!o.boundingBox&&i.setBoundingBox&&(o.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=o}return d(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,o=t.getIndex();return{roots:n,index:r?o.array.slice():o.array}}},{key:"deserialize",value:function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.index,a=t.roots,u=new n(r,c({},h,!0));if(u._roots=a,o){var s=r.getIndex();if(null===s){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else s.array!==i&&(s.array.set(i),s.needsUpdate=!0)}return u}}]),d(n,[{key:"refit",value:function(){for(var e,t,n,o,i=this.geometry,a=i.index.array,u=i.attributes.position.array,s=this._roots,l=0,f=s.length;ly&&(y=x),Bd&&(d=B),mh&&(h=m)}return(o[e+0]!==l||o[e+1]!==f||o[e+2]!==v||o[e+3]!==y||o[e+4]!==d||o[e+5]!==h)&&(o[e+0]=l,o[e+1]=f,o[e+2]=v,o[e+3]=y,o[e+4]=d,o[e+5]=h,!0)}var w=e+8,A=t[e+6],T=c(w),k=c(A),_=T||k;if(_)for(var E=0;E<3;E++){var P=w+E,j=A+E,S=o[P],F=o[P+3],U=o[j],I=o[j+3];o[e+E]=SI?F:I}return _}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],o=new Uint32Array(n),i=new Uint16Array(n);!function t(a){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var s=2*a;var l=i[s+15]===r.IS_LEAFNODE_FLAG;if(l){var f=o[a+6],c=i[s+14];e(u,l,new Float32Array(n,4*a,6),f,c)}else{var v=a+r.BYTES_PER_NODE/4,y=o[a+6],d=o[a+7],h=e(u,l,new Float32Array(n,4*a,6),d);h||(t(v,u+1),t(y,u+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var o,i=this.geometry,u=s(this._roots);try{for(u.s();!(o=u.n()).done;){var l=o.value;(0,a.setBuffer)(l),(0,a.raycast)(0,e,i,t,r,n)}}catch(f){u.e(f)}finally{u.f()}(0,a.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,o=this.geometry,i=null,u=s(this._roots);try{for(u.s();!(n=u.n()).done;){var l=n.value;(0,a.setBuffer)(l);var f=(0,a.raycastFirst)(0,e,o,t,r);null!=f&&(null==i||f.distance2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r=r||function(e,t,r,n,o){return o};var o,i=this.geometry,u=!1,l=s(this._roots);try{for(l.s();!(o=l.n()).done;){var f=o.value;if((0,a.setBuffer)(f),u=(0,a.shapecast)(0,e,i,t,r,n))break}}catch(c){l.e(c)}finally{l.f()}return(0,a.clearBuffer)(),u}},{key:"intersectsBox",value:function(e,t,r){return p.set(t.min,t.max,r),p.update(),this.shapecast(e,function(e){return p.intersectsBox(e)},function(e){return p.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),p.set(t.boundingBox.min,t.boundingBox.max,r),p.update();var s=t.attributes.position,l=t.index,f=null,c=null;n&&(f=x),o&&(c=B);var v=1/0;return this.shapecast(e,function(e,t,r){return rv)){b.update();var h=e.distanceToTriangle(b,f,c);if(h3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,i=1/0;return this.shapecast(e,function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t obb2.intersectsBox( box ), function ( tri ) { + const res = otherGeometry.boundsTree.shapecast( cachedMesh, { - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); + intersectsBounds: box => obb2.intersectsBox( box ), - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + intersectsTriangle: tri => { - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { + tri.a.applyMatrix4( geometryToBvh ); + tri.b.applyMatrix4( geometryToBvh ); + tri.c.applyMatrix4( geometryToBvh ); + tri.update(); - return true; + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle2, i, thisIndex, thisPos ); + triangle2.update(); + if ( tri.intersectsTriangle( triangle2 ) ) { + + return true; + + } } - } + return false; - return false; + } } ); cachedMesh.geometry = null; @@ -2522,6 +2527,7 @@ const temp1 = new three.Vector3(); const temp2 = new three.Vector3(); const tempBox = new three.Box3(); + const triangle = new SeparatingAxisTriangle(); class MeshBVH { @@ -2618,7 +2624,19 @@ } - refit() { + refit( nodeIndices = null, terminationIndices = null ) { + + if ( nodeIndices && Array.isArray( nodeIndices ) ) { + + nodeIndices = new Set( nodeIndices ); + + } + + if ( terminationIndices && Array.isArray( terminationIndices ) ) { + + terminationIndices = new Set( terminationIndices ); + + } const geometry = this.geometry; const indexArr = geometry.index.array; @@ -2635,7 +2653,7 @@ } - function _traverse( node32Index ) { + function _traverse( node32Index, force = false ) { const node16Index = node32Index * 2; const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; @@ -2699,8 +2717,24 @@ const left = node32Index + 8; const right = uint32Array[ node32Index + 6 ]; - const leftChange = _traverse( left ); - const rightChange = _traverse( right ); + let leftChange = false; + let forceLeft = force || terminationIndices && terminationIndices.has( left ); + let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true ); + if ( traverseLeft ) { + + leftChange = _traverse( left, forceLeft ); + + } + + let rightChange = false; + let forceRight = force || terminationIndices && terminationIndices.has( right ); + let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true ); + if ( traverseRight ) { + + rightChange = _traverse( right, forceRight ); + + } + const didChange = leftChange || rightChange; if ( didChange ) { @@ -2774,11 +2808,10 @@ setBuffer( root ); raycast( 0, mesh, geometry, raycaster, ray, intersects ); + clearBuffer(); } - clearBuffer(); - } raycastFirst( mesh, raycaster, ray ) { @@ -2789,6 +2822,7 @@ setBuffer( root ); const result = raycastFirst( 0, mesh, geometry, raycaster, ray ); + clearBuffer(); if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { @@ -2798,7 +2832,6 @@ } - clearBuffer(); return closestResult; @@ -2812,6 +2845,7 @@ setBuffer( root ); result = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh ); + clearBuffer(); if ( result ) { @@ -2821,23 +2855,93 @@ } - clearBuffer(); - return result; } - shapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) { - - // default the triangle intersection function - intersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained ); + shapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) { const geometry = this.geometry; + if ( callbacks instanceof Function ) { + + if ( _intersectsTriangleFunc ) { + + // Support the previous function signature that provided three sequential index buffer + // indices here. + const originalTriangleFunc = _intersectsTriangleFunc; + _intersectsTriangleFunc = ( tri, index, contained, depth ) => { + + const i3 = index * 3; + return originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth ); + + }; + + + } + + callbacks = { + + boundsTraverseOrder: _orderNodesFunc, + intersectsBounds: callbacks, + intersectsTriangle: _intersectsTriangleFunc, + intersectsRange: null, + + }; + + console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' ); + + } + + let { + boundsTraverseOrder, + intersectsBounds, + intersectsRange, + intersectsTriangle, + } = callbacks; + + if ( intersectsRange && intersectsTriangle ) { + + const originalIntersectsRange = intersectsRange; + intersectsRange = ( offset, count, contained, depth, nodeIndex ) => { + + if ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) { + + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); + + } + + return true; + + }; + + } else if ( ! intersectsRange ) { + + if ( intersectsTriangle ) { + + intersectsRange = ( offset, count, contained, depth ) => { + + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); + + }; + + } else { + + intersectsRange = ( offset, count, contained ) => { + + return contained; + + }; + + } + + } + let result = false; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); + result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder ); + clearBuffer(); if ( result ) { @@ -2847,8 +2951,6 @@ } - clearBuffer(); - return result; } @@ -2861,8 +2963,10 @@ return this.shapecast( mesh, - box => obb.intersectsBox( box ), - tri => obb.intersectsTriangle( tri ) + { + intersectsBounds: box => obb.intersectsBox( box ), + intersectsTriangle: tri => obb.intersectsTriangle( tri ) + } ); } @@ -2871,8 +2975,10 @@ return this.shapecast( mesh, - box => sphere.intersectsBox( box ), - tri => tri.intersectsSphere( sphere ) + { + intersectsBounds: box => sphere.intersectsBox( box ), + intersectsTriangle: tri => tri.intersectsSphere( sphere ) + } ); } @@ -2908,66 +3014,80 @@ let closestDistance = Infinity; this.shapecast( mesh, - ( box, isLeaf, score ) => score < closestDistance && score < maxThreshold, - tri => { + { - if ( tri.needsUpdate ) { + boundsTraverseOrder: box => { - tri.update(); + return obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ); - } + }, + + intersectsBounds: ( box, isLeaf, score ) => { - const sphere1 = tri.sphere; - for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + return score < closestDistance && score < maxThreshold; - setTriangle( tri2, i2, index, pos ); - tri2.a.applyMatrix4( geometryToBvh ); - tri2.b.applyMatrix4( geometryToBvh ); - tri2.c.applyMatrix4( geometryToBvh ); - tri2.sphere.setFromPoints( tri2.points ); + }, - const sphere2 = tri2.sphere; - const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; - if ( sphereDist > closestDistance ) { + intersectsTriangle: tri => { - continue; + if ( tri.needsUpdate ) { + + tri.update(); } - tri2.update(); + const sphere1 = tri.sphere; + for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { - const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); - if ( dist < closestDistance ) { + setTriangle( tri2, i2, index, pos ); + tri2.a.applyMatrix4( geometryToBvh ); + tri2.b.applyMatrix4( geometryToBvh ); + tri2.c.applyMatrix4( geometryToBvh ); + tri2.sphere.setFromPoints( tri2.points ); - if ( target1 ) { + const sphere2 = tri2.sphere; + const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; + if ( sphereDist > closestDistance ) { - target1.copy( tempTarget1 ); + continue; } - if ( target2 ) { + tri2.update(); - target2.copy( tempTarget2 ); + const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); + if ( dist < closestDistance ) { - } + if ( target1 ) { - closestDistance = dist; + target1.copy( tempTarget1 ); - } + } - // stop traversal if we find a point that's under the given threshold - if ( dist < minThreshold ) { + if ( target2 ) { - return true; + target2.copy( tempTarget2 ); + + } + + closestDistance = dist; + + } + + // stop traversal if we find a point that's under the given threshold + if ( dist < minThreshold ) { + + return true; + + } } - } + return false; - return false; + } - }, - box => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ) + } ); @@ -2987,43 +3107,60 @@ // skip checking if over maxThreshold // set minThreshold = maxThreshold to quickly check if a point is within a threshold // returns Infinity if no value found - let closestDistance = Infinity; + const minThresholdSq = minThreshold * minThreshold; + const maxThresholdSq = maxThreshold * maxThreshold; + let closestDistanceSq = Infinity; this.shapecast( mesh, - ( box, isLeaf, score ) => score < closestDistance && score < maxThreshold, - tri => { + { - tri.closestPointToPoint( point, temp ); - const dist = point.distanceTo( temp ); - if ( dist < closestDistance ) { + boundsTraverseOrder: box => { - if ( target ) { + temp.copy( point ).clamp( box.min, box.max ); + return temp.distanceToSquared( point ); - target.copy( temp ); + }, - } + intersectsBounds: ( box, isLeaf, score ) => { - closestDistance = dist; + return score < closestDistanceSq && score < maxThresholdSq; - } + }, - if ( dist < minThreshold ) { + intersectsTriangle: tri => { - return true; + tri.closestPointToPoint( point, temp ); + const distSq = point.distanceToSquared( temp ); + if ( distSq < closestDistanceSq ) { - } else { + if ( target ) { - return false; + target.copy( temp ); - } + } + + closestDistanceSq = distSq; + + } + + if ( distSq < minThresholdSq ) { + + return true; - }, - box => box.distanceToPoint( point ) + } else { + + return false; + + } + + }, + + } ); - return closestDistance; + return Math.sqrt( closestDistanceSq ); } diff --git a/umd/index.js.map b/umd/index.js.map index 250245b5f..eb497466f 100644 --- a/umd/index.js.map +++ b/umd/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","export function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\nconst tempBox = new Box3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geometry, options = {} ) {\r\n\r\n\t\tif ( ! geometry.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\tsetBoundingBox: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geometry, options );\r\n\r\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\r\n\r\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// retain references to the geometry so we can use them it without having to\r\n\t\t// take a geometry reference in every function.\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\trefit() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t_traverse( 0 );\r\n\r\n\t\t}\r\n\r\n\t\tfunction _traverse( node32Index ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\tconst leftChange = _traverse( left );\r\n\t\t\t\tconst rightChange = _traverse( right );\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\t// default the triangle intersection function\r\n\t\tintersectsTriangleFunc = intersectsTriangleFunc || ( ( tri, a, b, c, contained ) => contained );\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tclearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = otherGeometry.attributes.position;\r\n\t\tconst index = otherGeometry.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tgetBoundingBox( target ) {\r\n\r\n\t\ttarget.makeEmpty();\r\n\r\n\t\tconst roots = this._roots;\r\n\t\troots.forEach( buffer => {\r\n\r\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\r\n\t\t\ttarget.union( tempBox );\r\n\r\n\t\t} );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY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Utilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAEnC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,OAAO,GAAG,CAAC;;CAEZ,C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700 Subject: [PATCH 132/139] Add node index byte offset --- src/MeshBVH.js | 29 ++++++++++++++++++++--------- src/castFunctions.template.js | 11 +++++++---- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/MeshBVH.js b/src/MeshBVH.js index c4303bfe1..4a92acc55 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -137,6 +137,7 @@ export default class MeshBVH { const indexArr = geometry.index.array; const posArr = geometry.attributes.position.array; let buffer, uint32Array, uint16Array, float32Array; + let byteOffset = 0; const roots = this._roots; for ( let i = 0, l = roots.length; i < l; i ++ ) { @@ -144,11 +145,13 @@ export default class MeshBVH { uint32Array = new Uint32Array( buffer ); uint16Array = new Uint16Array( buffer ); float32Array = new Float32Array( buffer ); - _traverse( 0 ); + + _traverse( 0, byteOffset ); + byteOffset += buffer.byteLength; } - function _traverse( node32Index, force = false ) { + function _traverse( node32Index, byteOffset, force = false ) { const node16Index = node32Index * 2; const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; @@ -212,21 +215,26 @@ export default class MeshBVH { const left = node32Index + 8; const right = uint32Array[ node32Index + 6 ]; + // the indentifying node indices provided by the shapecast function include offsets of all + // root buffers to guarantee they're unique between roots so offset left and right indices here. + const offsetLeft = left + byteOffset; + const offsetRight = right + byteOffset; + let leftChange = false; - let forceLeft = force || terminationIndices && terminationIndices.has( left ); - let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true ); + let forceLeft = force || terminationIndices && terminationIndices.has( offsetLeft ); + let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( offsetLeft ) : true ); if ( traverseLeft ) { - leftChange = _traverse( left, forceLeft ); + leftChange = _traverse( left, byteOffset, forceLeft ); } let rightChange = false; - let forceRight = force || terminationIndices && terminationIndices.has( right ); - let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true ); + let forceRight = force || terminationIndices && terminationIndices.has( offsetRight ); + let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( offsetRight ) : true ); if ( traverseRight ) { - rightChange = _traverse( right, forceRight ); + rightChange = _traverse( right, byteOffset, forceRight ); } @@ -432,10 +440,11 @@ export default class MeshBVH { } let result = false; + let byteOffset = 0; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder ); + result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset ); clearBuffer(); if ( result ) { @@ -444,6 +453,8 @@ export default class MeshBVH { } + byteOffset += root.byteLength; + } return result; diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index e2672ea70..d79354bf2 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -136,6 +136,7 @@ export const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc = null, + byteOffset = 0, depth = 0, triangle = _triangle, cachedBox1 = _cachedBox1, @@ -233,7 +234,7 @@ export const shapecast = ( function () { } const isC1Leaf = IS_LEAF( c1 * 2 ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, byteOffset + c1 ); let c1StopTraversal; if ( c1Intersection === CONTAINED ) { @@ -242,7 +243,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, byteOffset + c1 ); } else { @@ -255,6 +256,7 @@ export const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, + byteOffset, depth + 1, triangle, cachedBox1, @@ -271,7 +273,7 @@ export const shapecast = ( function () { arrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); const isC2Leaf = IS_LEAF( c2 * 2 ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, byteOffset + c2 ); let c2StopTraversal; if ( c2Intersection === CONTAINED ) { @@ -280,7 +282,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, byteOffset + c2 ); } else { @@ -293,6 +295,7 @@ export const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, + byteOffset, depth + 1, triangle, cachedBox1, From 7b0aadd8f101a0d5e0c138ba4b69f36ec81e8a72 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 13 May 2021 11:34:25 -0700 Subject: [PATCH 133/139] update variable name --- src/castFunctions.template.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/castFunctions.template.js b/src/castFunctions.template.js index d79354bf2..f47eb1530 100644 --- a/src/castFunctions.template.js +++ b/src/castFunctions.template.js @@ -136,7 +136,7 @@ export const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc = null, - byteOffset = 0, + nodeIndexByteOffset = 0, // offset for unique node identifier depth = 0, triangle = _triangle, cachedBox1 = _cachedBox1, @@ -234,7 +234,7 @@ export const shapecast = ( function () { } const isC1Leaf = IS_LEAF( c1 * 2 ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, byteOffset + c1 ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 ); let c1StopTraversal; if ( c1Intersection === CONTAINED ) { @@ -243,7 +243,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, byteOffset + c1 ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1 ); } else { @@ -256,7 +256,7 @@ export const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, - byteOffset, + nodeIndexByteOffset, depth + 1, triangle, cachedBox1, @@ -273,7 +273,7 @@ export const shapecast = ( function () { arrayToBox( BOUNDING_DATA_INDEX( c2 ), float32Array, box2 ); const isC2Leaf = IS_LEAF( c2 * 2 ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, byteOffset + c2 ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 ); let c2StopTraversal; if ( c2Intersection === CONTAINED ) { @@ -282,7 +282,7 @@ export const shapecast = ( function () { const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, byteOffset + c2 ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2 ); } else { @@ -295,7 +295,7 @@ export const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, - byteOffset, + nodeIndexByteOffset, depth + 1, triangle, cachedBox1, From ed309d242163d0658c6e4049fe582019d50d9123 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Thu, 13 May 2021 11:48:02 -0700 Subject: [PATCH 134/139] Run build --- example/bundle/asyncGenerate.4a48c6e8.js | 4 +- example/bundle/asyncGenerate.html | 3 +- example/bundle/characterMovement.725f956b.js | 4 +- example/bundle/collectTriangles.9c45819a.js | 4 +- example/bundle/collectTriangles.html | 3 +- example/bundle/distancecast.4107d8f2.js | 4 +- example/bundle/distancecast.html | 3 +- .../bundle/generateAsync.worker.13d14241.js | 4 +- example/bundle/physics.50b811f1.js | 4 +- example/bundle/randomSampleDebug.32ad2b43.js | 4 +- example/bundle/raycast.88074831.js | 4 +- example/bundle/raycast.html | 3 +- example/bundle/sculpt.493e9c78.js | 4 +- example/bundle/selection.383a520f.js | 4 +- example/bundle/shapecast.b93a7fe2.js | 4 +- src/castFunctions.js | 11 +++-- umd/index.js | 40 +++++++++++++------ umd/index.js.map | 2 +- 18 files changed, 65 insertions(+), 44 deletions(-) diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index 5cf598b64..3eae58c01 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -30,9 +30,9 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"./ThreeIntersectionUtilities.js":"lzxM"}],"dxfM":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToBox=r,exports.iterateOverTriangles=t;var e=require("./TriangleUtils.js");function r(e,r,t){t.min.x=r[e],t.min.y=r[e+1],t.min.z=r[e+2],t.max.x=r[e+3],t.max.y=r[e+4],t.max.z=r[e+5]}function t(r,t,i,n,a,s,o){for(var x=i.index,u=i.attributes.position,l=r,m=t+r;l=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var o=this.worker;return this.running=!0,new Promise(function(a,u){o.onmessage=function(s){t.running=!1,o.onmessage=null;var f=s.data,l=f.serialized,d=f.position,c=f.error;if(c)u(new Error(c));else{var h=r.default.deserialize(l,n,!1),g=Object.assign({setBoundingBox:!0},i);n.attributes.position.array=d,n.index&&(n.index.array=l.index),g.setBoundingBox&&(n.boundingBox=h.getBoundingBox(new e.Box3)),a(h)}};var s=n.index?n.index.array:null,f=n.attributes.position.array;if(f.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var l=[f];s&&l.push(s),o.postMessage({index:s,position:f,options:i},l.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),n}();exports.GenerateMeshBVHWorker=a; },{"three":"dKqR","../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { diff --git a/example/bundle/asyncGenerate.html b/example/bundle/asyncGenerate.html index 079691e54..c05dcda16 100644 --- a/example/bundle/asyncGenerate.html +++ b/example/bundle/asyncGenerate.html @@ -1 +1,2 @@ -THREE.js BVH Geometry Collect Triangles
\ No newline at end of file +THREE.js BVH Geometry Collect Triangles
+ \ No newline at end of file diff --git a/example/bundle/characterMovement.725f956b.js b/example/bundle/characterMovement.725f956b.js index 731011ac5..c87f5e675 100644 --- a/example/bundle/characterMovement.725f956b.js +++ b/example/bundle/characterMovement.725f956b.js @@ -38,9 +38,9 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"./ThreeIntersectionUtilities.js":"lzxM"}],"dxfM":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToBox=r,exports.iterateOverTriangles=t;var e=require("./TriangleUtils.js");function r(e,r,t){t.min.x=r[e],t.min.y=r[e+1],t.min.z=r[e+2],t.max.x=r[e+3],t.max.y=r[e+4],t.max.z=r[e+5]}function t(r,t,i,n,a,s,o){for(var x=i.index,u=i.attributes.position,l=r,m=t+r;l=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iTHREE.js BVH Geometry Collect Triangles \ No newline at end of file +THREE.js BVH Geometry Collect Triangles + \ No newline at end of file diff --git a/example/bundle/distancecast.4107d8f2.js b/example/bundle/distancecast.4107d8f2.js index 6fa950ca8..50e7d3186 100644 --- a/example/bundle/distancecast.4107d8f2.js +++ b/example/bundle/distancecast.4107d8f2.js @@ -563,9 +563,9 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"./ThreeIntersectionUtilities.js":"lzxM"}],"dxfM":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToBox=r,exports.iterateOverTriangles=t;var e=require("./TriangleUtils.js");function r(e,r,t){t.min.x=r[e],t.min.y=r[e+1],t.min.z=r[e+2],t.max.x=r[e+3],t.max.y=r[e+4],t.max.z=r[e+5]}function t(r,t,i,n,a,s,o){for(var x=i.index,u=i.attributes.position,l=r,m=t+r;l=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return rTHREE.js BVH Geometry Closest Distance
\ No newline at end of file +THREE.js BVH Geometry Closest Distance
+ \ No newline at end of file diff --git a/example/bundle/generateAsync.worker.13d14241.js b/example/bundle/generateAsync.worker.13d14241.js index 43d4657df..bb95c3e7c 100644 --- a/example/bundle/generateAsync.worker.13d14241.js +++ b/example/bundle/generateAsync.worker.13d14241.js @@ -25,9 +25,9 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"./ThreeIntersectionUtilities.js":"lzxM"}],"dxfM":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToBox=r,exports.iterateOverTriangles=t;var e=require("./TriangleUtils.js");function r(e,r,t){t.min.x=r[e],t.min.y=r[e+1],t.min.z=r[e+2],t.max.x=r[e+3],t.max.y=r[e+4],t.max.z=r[e+5]}function t(r,t,i,n,a,s,o){for(var x=i.index,u=i.attributes.position,l=r,m=t+r;l=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return rTHREE.js BVH Geometry Raycasting \ No newline at end of file +THREE.js BVH Geometry Raycasting + \ No newline at end of file diff --git a/example/bundle/sculpt.493e9c78.js b/example/bundle/sculpt.493e9c78.js index 6771c722c..c362d6206 100644 --- a/example/bundle/sculpt.493e9c78.js +++ b/example/bundle/sculpt.493e9c78.js @@ -559,9 +559,9 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"./ThreeIntersectionUtilities.js":"lzxM"}],"dxfM":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToBox=r,exports.iterateOverTriangles=t;var e=require("./TriangleUtils.js");function r(e,r,t){t.min.x=r[e],t.min.y=r[e+1],t.min.z=r[e+2],t.max.x=r[e+3],t.max.y=r[e+4],t.max.z=r[e+5]}function t(r,t,i,n,a,s,o){for(var x=i.index,u=i.attributes.position,l=r,m=t+r;l=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,w=p[r+6]):(T=p[r+6],w=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[w+h]:M>=s[w+h+3])return A}var m=f(w,s,a,u)?c(w,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:e,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:i;function T(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var h=2*a,b=g,U=y,A=B;if(65535===U[h+15])return x(A[a+6],U[h+14],!1,p,a);var M,m,j,q,O=a+8,N=A[a+6],C=O,S=N;if(c&&(j=f,q=d,(0,t.arrayToBox)(C,b,j),(0,t.arrayToBox)(S,b,q),M=c(j),(m=c(q))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,w=g,h=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===h[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,w,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,w,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=h[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,w,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:r.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,t.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,r){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=r.getIndex();return{roots:n,index:t?i.array.slice():i.array}}},{key:"deserialize",value:function(r,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=r.index,o=r.roots,s=new n(t,f({},h,!0));if(s._roots=o,i){var u=t.getIndex();if(null===u){var l=new e.BufferAttribute(r.index,1,!1);t.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),r&&Array.isArray(r)&&(r=new Set(r));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=this._roots,f=0,d=c.length;f1&&void 0!==arguments[1]&&arguments[1],c=2*n;if(a[c+15]===t.IS_LEAFNODE_FLAG){for(var f=i[n+6],d=1/0,y=1/0,h=1/0,g=-1/0,p=-1/0,B=-1/0,b=3*f,m=3*(f+a[c+14]);bg&&(g=T),wp&&(p=w),AB&&(B=A)}return(o[n+0]!==d||o[n+1]!==y||o[n+2]!==h||o[n+3]!==g||o[n+4]!==p||o[n+5]!==B)&&(o[n+0]=d,o[n+1]=y,o[n+2]=h,o[n+3]=g,o[n+4]=p,o[n+5]=B,!0)}var k=n+8,S=i[n+6],O=!1,_=s||r&&r.has(k);(_||!e||e.has(k))&&(O=v(k,_));var E=!1,j=s||r&&r.has(S);(j||!e||e.has(S))&&(E=v(S,j));var P=O||E;if(P)for(var F=0;F<3;F++){var M=k+F,U=S+F,I=o[M],q=o[M+3],G=o[U],V=o[U+3];o[n+F]=IV?q:V}return P}}},{key:"traverse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[r],i=new Uint32Array(n),a=new Uint16Array(n);!function r(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===t.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+t.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(r(d,s+1),r(v,s+1))}}(0)}},{key:"raycast",value:function(e,r,t,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,r,t,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,r,t){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,r,t);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;r.boundingBox||r.computeBoundingBox(),g.set(r.boundingBox.min,r.boundingBox.max,t),g.update();var u=r.attributes.position,l=r.index,c=null,f=null;n&&(c=b),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,r,t){return td)){B.update();var h=e.distanceToTriangle(B,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(r).clamp(e.min,e.max),p.distanceToSquared(r)},intersectsBounds:function(e,r,t){return t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAEnC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,OAAO,GAAG,CAAC;;CAEZ,CAAC;;AAED,CAAO,SAAS,UAAU,EAAE,GA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,GAAG;;CAEjC,EAAE,KAAK,IAAI,CAAC,QAAQ,KAAK,SAAS,GAAG,OAAO;;CAE5C,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC;CACrD,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,CAAC;;CAE7D,EAAE,KAAK,SAAS,CAAC,YAAY,KAAK,IAAI,GAAG;;CAEzC,GAAG,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;CAC7E,GAAG,KAAK,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;;CAErC,GAAG,MAAM;;CAET,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\n\n// For speed and readability this script is processed to replace the macro-like calls\n// with inline buffer reads. See generate-cast-functions.js.\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\n\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { CONTAINED } from './Constants.js';\n\nconst boundingBox = new Box3();\nconst boxIntersection = new Vector3();\nconst xyzFields = [ 'x', 'y', 'z' ];\n\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\n\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\n\tif ( isLeaf ) {\n\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\n\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\n\n\t} else {\n\n\t\tconst leftIndex = nodeIndex32 + 8;\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\n\n\t\t}\n\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\n\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\n\tif ( isLeaf ) {\n\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\n\t\tconst rayDir = ray.direction[ xyzAxis ];\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\n\t\tlet c1, c2;\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = nodeIndex32 + 8;\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\n\n\t\t} else {\n\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\n\t\t\tc2 = nodeIndex32 + 8;\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\n\t\t\tconst point = c1Result.point[ xyzAxis ];\n\t\t\tconst isOutside = leftToRight ?\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\n\t\t// intersection in the second, so check the second node and then take the better of the two\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport const shapecast = ( function () {\n\n\tconst _triangle = new SeparatingAxisTriangle();\n\tconst _cachedBox1 = new Box3();\n\tconst _cachedBox2 = new Box3();\n\n\treturn function shapecast(\n\t\tnodeIndex32,\n\t\tmesh,\n\t\tgeometry,\n\t\tintersectsBoundsFunc,\n\t\tintersectsRangeFunc,\n\t\tnodeScoreFunc = null,\n\t\tnodeIndexByteOffset = 0, // offset for unique node identifier\n\t\tdepth = 0,\n\t\ttriangle = _triangle,\n\t\tcachedBox1 = _cachedBox1,\n\t\tcachedBox2 = _cachedBox2\n\t) {\n\n\t\t// Define these inside the function so it has access to the local variables needed\n\t\t// when converting to the buffer equivalents\n\t\tfunction getLeftOffset( nodeIndex32 ) {\n\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\n\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\n\n\t\t}\n\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\n\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\n\n\t\t\t\t// adjust offset to point to the right node\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\t// return the end offset of the triangle range\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\n\n\t\t}\n\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\n\n\t\t} else {\n\n\t\t\tconst left = nodeIndex32 + 8;\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\t\t\tlet c1 = left;\n\t\t\tlet c2 = right;\n\n\t\t\tlet score1, score2;\n\t\t\tlet box1, box2;\n\t\t\tif ( nodeScoreFunc ) {\n\n\t\t\t\tbox1 = cachedBox1;\n\t\t\t\tbox2 = cachedBox2;\n\n\t\t\t\t// bounding data is not offset\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\n\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\n\n\t\t\t\tif ( score2 < score1 ) {\n\n\t\t\t\t\tc1 = right;\n\t\t\t\t\tc2 = left;\n\n\t\t\t\t\tconst temp = score1;\n\t\t\t\t\tscore1 = score2;\n\t\t\t\t\tscore2 = temp;\n\n\t\t\t\t\tbox1 = box2;\n\t\t\t\t\t// box2 is always set before use below\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Check box 1 intersection\n\t\t\tif ( ! box1 ) {\n\n\t\t\t\tbox1 = cachedBox1;\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\n\n\t\t\t}\n\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 );\n\n\t\t\tlet c1StopTraversal;\n\t\t\tif ( c1Intersection === CONTAINED ) {\n\n\t\t\t\tconst offset = getLeftOffset( c1 );\n\t\t\t\tconst end = getRightEndOffset( c1 );\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1 );\n\n\t\t\t} else {\n\n\t\t\t\tc1StopTraversal =\n\t\t\t\t\tc1Intersection &&\n\t\t\t\t\tshapecast(\n\t\t\t\t\t\tc1,\n\t\t\t\t\t\tmesh,\n\t\t\t\t\t\tgeometry,\n\t\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\t\tdepth + 1,\n\t\t\t\t\t\ttriangle,\n\t\t\t\t\t\tcachedBox1,\n\t\t\t\t\t\tcachedBox2\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c1StopTraversal ) return true;\n\n\t\t\t// Check box 2 intersection\n\t\t\t// cached box2 will have been overwritten by previous traversal\n\t\t\tbox2 = cachedBox2;\n\t\t\tarrayToBox( c2, float32Array, box2 );\n\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 );\n\n\t\t\tlet c2StopTraversal;\n\t\t\tif ( c2Intersection === CONTAINED ) {\n\n\t\t\t\tconst offset = getLeftOffset( c2 );\n\t\t\t\tconst end = getRightEndOffset( c2 );\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2 );\n\n\t\t\t} else {\n\n\t\t\t\tc2StopTraversal =\n\t\t\t\t\tc2Intersection &&\n\t\t\t\t\tshapecast(\n\t\t\t\t\t\tc2,\n\t\t\t\t\t\tmesh,\n\t\t\t\t\t\tgeometry,\n\t\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\t\tdepth + 1,\n\t\t\t\t\t\ttriangle,\n\t\t\t\t\t\tcachedBox1,\n\t\t\t\t\t\tcachedBox2\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c2StopTraversal ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nexport const intersectsGeometry = ( function () {\n\n\tconst triangle = new SeparatingAxisTriangle();\n\tconst triangle2 = new SeparatingAxisTriangle();\n\tconst cachedMesh = new Mesh();\n\tconst invertedMat = new Matrix4();\n\n\tconst obb = new OrientedBox();\n\tconst obb2 = new OrientedBox();\n\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\n\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tif ( cachedObb === null ) {\n\n\t\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\t\totherGeometry.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\t\tobb.update();\n\t\t\tcachedObb = obb;\n\n\t\t}\n\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\n\t\tif ( isLeaf ) {\n\n\t\t\tconst thisGeometry = geometry;\n\t\t\tconst thisIndex = thisGeometry.index;\n\t\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\t\tconst index = otherGeometry.index;\n\t\t\tconst pos = otherGeometry.attributes.position;\n\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\n\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\n\t\t\t// here.\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\n\t\t\t\tobb2.matrix.copy( invertedMat );\n\t\t\t\tobb2.update();\n\n\t\t\t\tcachedMesh.geometry = otherGeometry;\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\n\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\n\n\t\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\n\t\t\t\t\t\t\ttriangle2.update();\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\t\t\t\tcachedMesh.geometry = null;\n\n\t\t\t\treturn res;\n\n\t\t\t} else {\n\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\n\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\n\t\t\t\t\ttriangle.update();\n\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\n\t\t\t\t\t\ttriangle2.update();\n\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = nodeIndex32 + 8;\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\n\t\t\tarrayToBox( left, float32Array, boundingBox );\n\t\t\tconst leftIntersection =\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( leftIntersection ) return true;\n\n\t\t\tarrayToBox( right, float32Array, boundingBox );\n\t\t\tconst rightIntersection =\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( rightIntersection ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nfunction intersectRay( nodeIndex32, array, ray, target ) {\n\n\tarrayToBox( nodeIndex32, array, boundingBox );\n\treturn ray.intersectBox( boundingBox, target );\n\n}\n\nconst bufferStack = [];\nlet _prevBuffer;\nlet _float32Array;\nlet _uint16Array;\nlet _uint32Array;\nexport function setBuffer( buffer ) {\n\n\tif ( _prevBuffer ) {\n\n\t\tbufferStack.push( _prevBuffer );\n\n\t}\n\n\t_prevBuffer = buffer;\n\t_float32Array = new Float32Array( buffer );\n\t_uint16Array = new Uint16Array( buffer );\n\t_uint32Array = new Uint32Array( buffer );\n\n}\n\nexport function clearBuffer() {\n\n\t_prevBuffer = null;\n\t_float32Array = null;\n\t_uint16Array = null;\n\t_uint32Array = null;\n\n\tif ( bufferStack.length ) {\n\n\t\tsetBuffer( bufferStack.pop() );\n\n\t}\n\n}\n","import { Vector3, BufferAttribute, Box3 } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctions.js';\r\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\r\n\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\nconst tempBox = new Box3();\r\nconst triangle = new SeparatingAxisTriangle();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tconst rootData = bvh._roots;\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geometry, options = {} ) {\r\n\r\n\t\tif ( ! geometry.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\r\n\t\t\tsetBoundingBox: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildPackedTree( geometry, options );\r\n\r\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\r\n\r\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// retain references to the geometry so we can use them it without having to\r\n\t\t// take a geometry reference in every function.\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\trefit( nodeIndices = null, terminationIndices = null ) {\r\n\r\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\r\n\r\n\t\t\tnodeIndices = new Set( nodeIndices );\r\n\r\n\t\t}\r\n\r\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\r\n\r\n\t\t\tterminationIndices = new Set( terminationIndices );\r\n\r\n\t\t}\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst indexArr = geometry.index.array;\r\n\t\tconst posArr = geometry.attributes.position.array;\r\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\r\n\t\tlet byteOffset = 0;\r\n\t\tconst roots = this._roots;\r\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\r\n\r\n\t\t\tbuffer = roots[ i ];\r\n\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\tfloat32Array = new Float32Array( buffer );\r\n\r\n\t\t\t_traverse( 0, byteOffset );\r\n\t\t\tbyteOffset += buffer.byteLength;\r\n\r\n\t\t}\r\n\r\n\t\tfunction _traverse( node32Index, byteOffset, force = false ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\r\n\t\t\t\tlet minx = Infinity;\r\n\t\t\t\tlet miny = Infinity;\r\n\t\t\t\tlet minz = Infinity;\r\n\t\t\t\tlet maxx = - Infinity;\r\n\t\t\t\tlet maxy = - Infinity;\r\n\t\t\t\tlet maxz = - Infinity;\r\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\r\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\r\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\r\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\r\n\r\n\t\t\t\t\tif ( x < minx ) minx = x;\r\n\t\t\t\t\tif ( x > maxx ) maxx = x;\r\n\r\n\t\t\t\t\tif ( y < miny ) miny = y;\r\n\t\t\t\t\tif ( y > maxy ) maxy = y;\r\n\r\n\t\t\t\t\tif ( z < minz ) minz = z;\r\n\t\t\t\t\tif ( z > maxz ) maxz = z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\r\n\t\t\t\t) {\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\r\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\r\n\r\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\r\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\r\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + 8;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\r\n\t\t\t\t// the indentifying node indices provided by the shapecast function include offsets of all\r\n\t\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\r\n\t\t\t\tconst offsetLeft = left + byteOffset;\r\n\t\t\t\tconst offsetRight = right + byteOffset;\r\n\r\n\t\t\t\tlet leftChange = false;\r\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( offsetLeft );\r\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( offsetLeft ) : true );\r\n\t\t\t\tif ( traverseLeft ) {\r\n\r\n\t\t\t\t\tleftChange = _traverse( left, byteOffset, forceLeft );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet rightChange = false;\r\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( offsetRight );\r\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( offsetRight ) : true );\r\n\t\t\t\tif ( traverseRight ) {\r\n\r\n\t\t\t\t\trightChange = _traverse( right, byteOffset, forceRight );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst didChange = leftChange || rightChange;\r\n\r\n\t\t\t\tif ( didChange ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst lefti = left + i;\r\n\t\t\t\t\t\tconst righti = right + i;\r\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\r\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\r\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\r\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\r\n\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\r\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn didChange;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t_traverse( 0 );\r\n\r\n\t\tfunction _traverse( node32Index, depth = 0 ) {\r\n\r\n\t\t\tconst node16Index = node32Index * 2;\r\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\r\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\r\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\r\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\r\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\r\n\r\n\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t_traverse( left, depth + 1 );\r\n\t\t\t\t\t_traverse( right, depth + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\r\n\t\t\tclearBuffer();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\r\n\t\t\tclearBuffer();\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\r\n\t\t\tclearBuffer();\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tif ( callbacks instanceof Function ) {\r\n\r\n\t\t\tif ( _intersectsTriangleFunc ) {\r\n\r\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\r\n\t\t\t\t// indices here.\r\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\r\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\r\n\r\n\t\t\t\t\tconst i3 = index * 3;\r\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\r\n\r\n\t\t\t\t};\r\n\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcallbacks = {\r\n\r\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\r\n\t\t\t\tintersectsBounds: callbacks,\r\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\r\n\t\t\t\tintersectsRange: null,\r\n\r\n\t\t\t};\r\n\r\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\r\n\r\n\t\t}\r\n\r\n\t\tlet {\r\n\t\t\tboundsTraverseOrder,\r\n\t\t\tintersectsBounds,\r\n\t\t\tintersectsRange,\r\n\t\t\tintersectsTriangle,\r\n\t\t} = callbacks;\r\n\r\n\t\tif ( intersectsRange && intersectsTriangle ) {\r\n\r\n\t\t\tconst originalIntersectsRange = intersectsRange;\r\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\r\n\r\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\r\n\r\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t};\r\n\r\n\t\t} else if ( ! intersectsRange ) {\r\n\r\n\t\t\tif ( intersectsTriangle ) {\r\n\r\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\r\n\r\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\r\n\r\n\t\t\t\t\treturn contained;\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlet result = false;\r\n\t\tlet byteOffset = 0;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tsetBuffer( root );\r\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\r\n\t\t\tclearBuffer();\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbyteOffset += root.byteLength;\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t{\r\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\r\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\r\n\t\t\t}\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t{\r\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\r\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\r\n\t\t\t}\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = otherGeometry.attributes.position;\r\n\t\tconst index = otherGeometry.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t{\r\n\r\n\t\t\t\tboundsTraverseOrder: box => {\r\n\r\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\r\n\r\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tconst minThresholdSq = minThreshold * minThreshold;\r\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t{\r\n\r\n\t\t\t\tboundsTraverseOrder: box => {\r\n\r\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\r\n\t\t\t\t\treturn temp.distanceToSquared( point );\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\r\n\r\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\r\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = distSq;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t}\r\n\r\n\t\t);\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tgetBoundingBox( target ) {\r\n\r\n\t\ttarget.makeEmpty();\r\n\r\n\t\tconst roots = this._roots;\r\n\t\troots.forEach( buffer => {\r\n\r\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\r\n\t\t\ttarget.union( tempBox );\r\n\r\n\t\t} );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CA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builds to /build --- esm/index.js => build/index.module.js | 1592 ++++++++++--------------- build/index.module.js.map | 1 + umd/index.js => build/index.umd.js | 2 +- build/index.umd.js.map | 1 + esm/index.js.map | 1 - rollup.config.js | 22 +- umd/index.js.map | 1 - 7 files changed, 644 insertions(+), 976 deletions(-) rename esm/index.js => build/index.module.js (69%) create mode 100644 build/index.module.js.map rename umd/index.js => build/index.umd.js (99%) create mode 100644 build/index.umd.js.map delete mode 100644 esm/index.js.map delete mode 100644 umd/index.js.map diff --git a/esm/index.js b/build/index.module.js similarity index 69% rename from esm/index.js rename to build/index.module.js index 39246cd09..c9d3c96f6 100644 --- a/esm/index.js +++ b/build/index.module.js @@ -623,23 +623,8 @@ function buildTree( geo, options ) { node.left = left; left.boundingData = new Float32Array( 6 ); - if ( lazyGeneration ) { - - getBounds( triangleBounds, lstart, lcount, left.boundingData ); - left.continueGeneration = function () { - - delete this.continueGeneration; - getCentroidBounds( triangleBounds, lstart, lcount, cacheCentroidBoundingData ); - splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); - - }; - - } else { - - getBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData ); - splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); - - } + getBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData ); + splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); // repeat for right const right = new MeshBVHNode(); @@ -648,23 +633,8 @@ function buildTree( geo, options ) { node.right = right; right.boundingData = new Float32Array( 6 ); - if ( lazyGeneration ) { - - getBounds( triangleBounds, rstart, rcount, right.boundingData ); - right.continueGeneration = function () { - - delete this.continueGeneration; - getCentroidBounds( triangleBounds, rstart, rcount, cacheCentroidBoundingData ); - splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); - - }; - - } else { - - getBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData ); - splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); - - } + getBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData ); + splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); } @@ -682,7 +652,6 @@ function buildTree( geo, options ) { const verbose = options.verbose; const maxLeafTris = options.maxLeafTris; const strategy = options.strategy; - const lazyGeneration = options.lazyGeneration; let reachedMaxDepth = false; const roots = []; @@ -723,22 +692,100 @@ function buildTree( geo, options ) { } - // if the geometry doesn't have a bounding box, then let's politely populate it using - // the work we did to determine the BVH root bounds - if ( geo.boundingBox == null ) { + return roots; + +} + +const BYTES_PER_NODE = 6 * 4 + 4 + 4; + +const IS_LEAFNODE_FLAG = 0xFFFF; + +function buildPackedTree( geo, options ) { + + // boundingData : 6 float32 + // right / offset : 1 uint32 + // splitAxis / isLeaf + count : 1 uint32 / 2 uint16 + const roots = buildTree( geo, options ); + + let float32Array; + let uint32Array; + let uint16Array; + const packedRoots = []; + for ( let i = 0; i < roots.length; i ++ ) { + + const root = roots[ i ]; + let nodeCount = countNodes( root ); + + const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); + float32Array = new Float32Array( buffer ); + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + populateBuffer( 0, root ); + packedRoots.push( buffer ); + + } + + return packedRoots; + + function countNodes( node ) { - const rootBox = new Box3(); - geo.boundingBox = new Box3(); + if ( node.count ) { - for ( let root of roots ) { + return 1; + + } else { - geo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) ); + return 1 + countNodes( node.left ) + countNodes( node.right ); } } - return roots; + function populateBuffer( byteOffset, node ) { + + const stride4Offset = byteOffset / 4; + const stride2Offset = byteOffset / 2; + const isLeaf = ! ! node.count; + const boundingData = node.boundingData; + for ( let i = 0; i < 6; i ++ ) { + + float32Array[ stride4Offset + i ] = boundingData[ i ]; + + } + + if ( isLeaf ) { + + const offset = node.offset; + const count = node.count; + uint32Array[ stride4Offset + 6 ] = offset; + uint16Array[ stride2Offset + 14 ] = count; + uint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG; + return byteOffset + BYTES_PER_NODE; + + } else { + + const left = node.left; + const right = node.right; + const splitAxis = node.splitAxis; + + let nextUnusedPointer; + nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); + + if ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) { + + throw new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' ); + + } + + uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; + nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); + + uint32Array[ stride4Offset + 7 ] = splitAxis; + return nextUnusedPointer; + + } + + } } @@ -1944,42 +1991,78 @@ function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) { } -const boundingBox = new Box3(); -const boxIntersection = new Vector3(); -const xyzFields$1 = [ 'x', 'y', 'z' ]; - -function intersectRay( node, ray, target ) { +function arrayToBox$1( nodeIndex32, array, target ) { - arrayToBox( node.boundingData, boundingBox ); + target.min.x = array[ nodeIndex32 ]; + target.min.y = array[ nodeIndex32 + 1 ]; + target.min.z = array[ nodeIndex32 + 2 ]; - return ray.intersectBox( boundingBox, target ); + target.max.x = array[ nodeIndex32 + 3 ]; + target.max.y = array[ nodeIndex32 + 4 ]; + target.max.z = array[ nodeIndex32 + 5 ]; } -function raycast( node, mesh, raycaster, ray, intersects ) { +function iterateOverTriangles( + offset, + count, + geometry, + intersectsTriangleFunc, + contained, + depth, + triangle +) { - if ( node.continueGeneration ) { + const index = geometry.index; + const pos = geometry.attributes.position; + for ( let i = offset, l = count + offset; i < l; i ++ ) { - node.continueGeneration(); + setTriangle( triangle, i * 3, index, pos ); + triangle.needsUpdate = true; + + if ( intersectsTriangleFunc( triangle, i, contained, depth ) ) { + + return true; + + } } - const isLeaf = ! ! node.count; + return false; + +} + +/* Generated from "castFunctions.template.js". Do not edit. */ + +const boundingBox = new Box3(); +const boxIntersection = new Vector3(); +const xyzFields$1 = [ 'x', 'y', 'z' ]; + +function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) { + + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - intersectTris( mesh, mesh.geometry, raycaster, ray, node.offset, node.count, intersects ); + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + + intersectTris( mesh, geometry, raycaster, ray, offset, count, intersects ); } else { - if ( intersectRay( node.left, ray, boxIntersection ) ) { + const leftIndex = nodeIndex32 + 8; + if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { - raycast( node.left, mesh, raycaster, ray, intersects ); + raycast( leftIndex, mesh, geometry, raycaster, ray, intersects ); } - if ( intersectRay( node.right, ray, boxIntersection ) ) { + const rightIndex = uint32Array[ nodeIndex32 + 6 ]; + if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { - raycast( node.right, mesh, raycaster, ray, intersects ); + raycast( rightIndex, mesh, geometry, raycaster, ray, intersects ); } @@ -1987,25 +2070,22 @@ function raycast( node, mesh, raycaster, ray, intersects ) { } -function raycastFirst( node, mesh, raycaster, ray ) { - - if ( node.continueGeneration ) { +function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { - node.continueGeneration(); + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - } - - const isLeaf = ! ! node.count; + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, node.offset, node.count ); + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + return intersectClosestTri( mesh, geometry, raycaster, ray, offset, count ); } else { - // consider the position of the split plane with respect to the oncoming ray; whichever direction // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = node.splitAxis; + const splitAxis = uint32Array[ nodeIndex32 + 7 ]; const xyzAxis = xyzFields$1[ splitAxis ]; const rayDir = ray.direction[ xyzAxis ]; const leftToRight = rayDir >= 0; @@ -2014,18 +2094,18 @@ function raycastFirst( node, mesh, raycaster, ray ) { let c1, c2; if ( leftToRight ) { - c1 = node.left; - c2 = node.right; + c1 = nodeIndex32 + 8; + c2 = uint32Array[ nodeIndex32 + 6 ]; } else { - c1 = node.right; - c2 = node.left; + c1 = uint32Array[ nodeIndex32 + 6 ]; + c2 = nodeIndex32 + 8; } - const c1Intersection = intersectRay( c1, ray, boxIntersection ); - const c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null; + const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); + const c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null; // if we got an intersection in the first node and it's closer than the second node's bounding // box, we don't need to consider the second node because it couldn't possibly be a better result @@ -2034,8 +2114,8 @@ function raycastFirst( node, mesh, raycaster, ray ) { // check if the point is within the second bounds const point = c1Result.point[ xyzAxis ]; const isOutside = leftToRight ? - point <= c2.boundingData[ splitAxis ] : - point >= c2.boundingData[ splitAxis + 3 ]; + point <= float32Array[ c2 + splitAxis ] : // min bounding data + point >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data if ( isOutside ) { @@ -2047,8 +2127,8 @@ function raycastFirst( node, mesh, raycaster, ray ) { // either there was no intersection in the first node, or there could still be a closer // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRay( c2, ray, boxIntersection ); - const c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null; + const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); + const c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null; if ( c1Result && c2Result ) { @@ -2070,40 +2150,12 @@ const shapecast = ( function () { const _cachedBox1 = new Box3(); const _cachedBox2 = new Box3(); - function iterateOverTriangles( - offset, - count, - geometry, - intersectsTriangleFunc, - contained, - depth, - triangle - ) { - - const index = geometry.index; - const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { - - setTriangle( triangle, i, index, pos ); - triangle.needsUpdate = true; - - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { - - return true; - - } - - } - - return false; - - } - return function shapecast( - node, + nodeIndex32, mesh, + geometry, intersectsBoundsFunc, - intersectsTriangleFunc = null, + intersectsRangeFunc, nodeScoreFunc = null, depth = 0, triangle = _triangle, @@ -2113,70 +2165,53 @@ const shapecast = ( function () { // Define these inside the function so it has access to the local variables needed // when converting to the buffer equivalents - function getLeftOffset( node ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - - while ( ! node.count ) { + function getLeftOffset( nodeIndex32 ) { - node = node.left; - if ( /* skip */ node.continueGeneration ) { + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; - node.continueGeneration(); + // traverse until we find a leaf + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { - } + nodeIndex32 = nodeIndex32 + 8; + nodeIndex16 = nodeIndex32 * 2; } - return node.offset; + return uint32Array[ nodeIndex32 + 6 ]; } - function getRightEndOffset( node ) { - - if ( node.continueGeneration ) { + function getRightEndOffset( nodeIndex32 ) { - node.continueGeneration(); + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; - } - - while ( ! node.count ) { - - node = node.right; - if ( /* skip */ node.continueGeneration ) { - - node.continueGeneration(); + // traverse until we find a leaf + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { - } + // adjust offset to point to the right node + nodeIndex32 = uint32Array[ nodeIndex32 + 6 ]; + nodeIndex16 = nodeIndex32 * 2; } - return node.offset + node.count; + // return the end offset of the triangle range + return uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ]; } - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - const isLeaf = ! ! node.count; - if ( isLeaf && intersectsTriangleFunc ) { + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); + if ( isLeaf ) { - const geometry = mesh.geometry; - const offset = node.offset; - const count = node.count; - return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + return intersectsRangeFunc( offset, count, false, depth, nodeIndex32 ); } else { - const left = node.left; - const right = node.right; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; let c1 = left; let c2 = right; @@ -2187,8 +2222,9 @@ const shapecast = ( function () { box1 = cachedBox1; box2 = cachedBox2; - arrayToBox( c1.boundingData, box1 ); - arrayToBox( c2.boundingData, box2 ); + // bounding data is not offset + arrayToBox$1( c1, float32Array, box1 ); + arrayToBox$1( c2, float32Array, box2 ); score1 = nodeScoreFunc( box1 ); score2 = nodeScoreFunc( box2 ); @@ -2213,22 +2249,21 @@ const shapecast = ( function () { if ( ! box1 ) { box1 = cachedBox1; - arrayToBox( c1.boundingData, box1 ); + arrayToBox$1( c1, float32Array, box1 ); } - const isC1Leaf = ! ! c1.count; - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); + const isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 ); let c1StopTraversal; if ( c1Intersection === CONTAINED ) { - const geometry = mesh.geometry; const offset = getLeftOffset( c1 ); const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 ); } else { @@ -2237,8 +2272,9 @@ const shapecast = ( function () { shapecast( c1, mesh, + geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc, depth + 1, triangle, @@ -2253,20 +2289,19 @@ const shapecast = ( function () { // Check box 2 intersection // cached box2 will have been overwritten by previous traversal box2 = cachedBox2; - arrayToBox( c2.boundingData, box2 ); + arrayToBox$1( c2, float32Array, box2 ); - const isC2Leaf = ! ! c2.count; - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); + const isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 ); let c2StopTraversal; if ( c2Intersection === CONTAINED ) { - const geometry = mesh.geometry; const offset = getLeftOffset( c2 ); const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 ); } else { @@ -2275,8 +2310,9 @@ const shapecast = ( function () { shapecast( c2, mesh, + geometry, intersectsBoundsFunc, - intersectsTriangleFunc, + intersectsRangeFunc, nodeScoreFunc, depth + 1, triangle, @@ -2306,74 +2342,76 @@ const intersectsGeometry = ( function () { const obb = new OrientedBox(); const obb2 = new OrientedBox(); - return function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); + return function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) { - } + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; if ( cachedObb === null ) { - if ( ! geometry.boundingBox ) { + if ( ! otherGeometry.boundingBox ) { - geometry.computeBoundingBox(); + otherGeometry.computeBoundingBox(); } - obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); obb.update(); cachedObb = obb; } - const isLeaf = ! ! node.count; + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); if ( isLeaf ) { - const thisGeometry = mesh.geometry; + const thisGeometry = geometry; const thisIndex = thisGeometry.index; const thisPos = thisGeometry.attributes.position; - const index = geometry.index; - const pos = geometry.attributes.position; + const index = otherGeometry.index; + const pos = otherGeometry.attributes.position; - const offset = node.offset; - const count = node.count; + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; // get the inverse of the geometry matrix so we can transform our triangles into the // geometry space we're trying to test. We assume there are fewer triangles being checked // here. invertedMat.copy( geometryToBvh ).invert(); - if ( geometry.boundsTree ) { + if ( otherGeometry.boundsTree ) { - arrayToBox( node.boundingData, obb2 ); + arrayToBox$1( nodeIndex32, float32Array, obb2 ); obb2.matrix.copy( invertedMat ); obb2.update(); - cachedMesh.geometry = geometry; - const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + cachedMesh.geometry = otherGeometry; + const res = otherGeometry.boundsTree.shapecast( cachedMesh, { - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); + intersectsBounds: box => obb2.intersectsBox( box ), - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + intersectsTriangle: tri => { - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { + tri.a.applyMatrix4( geometryToBvh ); + tri.b.applyMatrix4( geometryToBvh ); + tri.c.applyMatrix4( geometryToBvh ); + tri.update(); - return true; + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle2, i, thisIndex, thisPos ); + triangle2.update(); + if ( tri.intersectsTriangle( triangle2 ) ) { + + return true; + + } } - } + return false; - return false; + } } ); cachedMesh.geometry = null; @@ -2410,21 +2448,20 @@ const intersectsGeometry = ( function () { } else { - const left = node.left; - const right = node.right; + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; - arrayToBox( left.boundingData, boundingBox ); + arrayToBox$1( left, float32Array, boundingBox ); const leftIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( leftIntersection ) return true; - - arrayToBox( right.boundingData, boundingBox ); + arrayToBox$1( right, float32Array, boundingBox ); const rightIntersection = cachedObb.intersectsBox( boundingBox ) && - intersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb ); + intersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); if ( rightIntersection ) return true; @@ -2436,886 +2473,471 @@ const intersectsGeometry = ( function () { } )(); -const boundingBox$1 = new Box3(); -const boxIntersection$1 = new Vector3(); -const xyzFields$2 = [ 'x', 'y', 'z' ]; +function intersectRay( nodeIndex32, array, ray, target ) { + + arrayToBox$1( nodeIndex32, array, boundingBox ); + return ray.intersectBox( boundingBox, target ); -function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) { +} - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; +const bufferStack = []; +let _prevBuffer; +let _float32Array; +let _uint16Array; +let _uint32Array; +function setBuffer( buffer ) { - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf ) { + if ( _prevBuffer ) { - intersectTris( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ], intersects ); + bufferStack.push( _prevBuffer ); - } else { + } - if ( intersectRayBuffer( /* node left */ stride4Offset + 8, float32Array, ray, boxIntersection$1 ) ) { + _prevBuffer = buffer; + _float32Array = new Float32Array( buffer ); + _uint16Array = new Uint16Array( buffer ); + _uint32Array = new Uint32Array( buffer ); - raycastBuffer( /* node left */ stride4Offset + 8, mesh, raycaster, ray, intersects ); +} - } +function clearBuffer() { - if ( intersectRayBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], float32Array, ray, boxIntersection$1 ) ) { + _prevBuffer = null; + _float32Array = null; + _uint16Array = null; + _uint32Array = null; - raycastBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], mesh, raycaster, ray, intersects ); + if ( bufferStack.length ) { - } + setBuffer( bufferStack.pop() ); } } -function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) { - - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf ) { +const SKIP_GENERATION = Symbol( 'skip tree generation' ); - return intersectClosestTri( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ] ); +const obb = new OrientedBox(); +const temp = new Vector3(); +const tri2 = new SeparatingAxisTriangle(); +const temp1 = new Vector3(); +const temp2 = new Vector3(); +const tempBox = new Box3(); +const triangle = new SeparatingAxisTriangle(); - } else { +class MeshBVH { - // consider the position of the split plane with respect to the oncoming ray; whichever direction - // the ray is coming from, look for an intersection among that side of the tree first - const splitAxis = /* node splitAxis */ uint32Array[ stride4Offset + 7 ]; - const xyzAxis = xyzFields$2[ splitAxis ]; - const rayDir = ray.direction[ xyzAxis ]; - const leftToRight = rayDir >= 0; + static serialize( bvh, geometry, copyIndexBuffer = true ) { - // c1 is the child to check first - let c1, c2; - if ( leftToRight ) { + const rootData = bvh._roots; + const indexAttribute = geometry.getIndex(); + const result = { + roots: rootData, + index: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array, + }; - c1 = /* node left */ stride4Offset + 8; - c2 = /* node right */ uint32Array[ stride4Offset + 6 ]; + return result; - } else { + } - c1 = /* node right */ uint32Array[ stride4Offset + 6 ]; - c2 = /* node left */ stride4Offset + 8; + static deserialize( data, geometry, setIndex = true ) { - } + const { index, roots } = data; + const bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } ); + bvh._roots = roots; - const c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection$1 ); - const c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null; + if ( setIndex ) { - // if we got an intersection in the first node and it's closer than the second node's bounding - // box, we don't need to consider the second node because it couldn't possibly be a better result - if ( c1Result ) { + const indexAttribute = geometry.getIndex(); + if ( indexAttribute === null ) { - // check if the point is within the second bounds - const point = c1Result.point[ xyzAxis ]; - const isOutside = leftToRight ? - point <= /* c2 boundingData */ float32Array[ c2 + splitAxis ] : - point >= /* c2 boundingData */ float32Array[ c2 + splitAxis + 3 ]; + const newIndex = new BufferAttribute( data.index, 1, false ); + geometry.setIndex( newIndex ); - if ( isOutside ) { + } else if ( indexAttribute.array !== index ) { - return c1Result; + indexAttribute.array.set( index ); + indexAttribute.needsUpdate = true; } } - // either there was no intersection in the first node, or there could still be a closer - // intersection in the second, so check the second node and then take the better of the two - const c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection$1 ); - const c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null; + return bvh; - if ( c1Result && c2Result ) { + } - return c1Result.distance <= c2Result.distance ? c1Result : c2Result; + constructor( geometry, options = {} ) { - } else { + if ( ! geometry.isBufferGeometry ) { - return c1Result || c2Result || null; + throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); - } + } else if ( geometry.attributes.position.isInterleavedBufferAttribute ) { - } + throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); -} + } else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) { -const shapecastBuffer = ( function () { + throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); - const _triangle = new SeparatingAxisTriangle(); - const _cachedBox1 = new Box3(); - const _cachedBox2 = new Box3(); + } - function iterateOverTriangles( - offset, - count, - geometry, - intersectsTriangleFunc, - contained, - depth, - triangle - ) { + // default options + options = Object.assign( { - const index = geometry.index; - const pos = geometry.attributes.position; - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + strategy: CENTER, + maxDepth: 40, + maxLeafTris: 10, + verbose: true, - setTriangle( triangle, i, index, pos ); - triangle.needsUpdate = true; + setBoundingBox: true, - if ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) { + // undocumented options - return true; + // Whether to skip generating the tree. Used for deserialization. + [ SKIP_GENERATION ]: false - } + }, options ); + options.strategy = Math.max( 0, Math.min( 2, options.strategy ) ); - } + this._roots = null; + if ( ! options[ SKIP_GENERATION ] ) { - return false; - - } - - return function shapecastBuffer( stride4Offset, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc = null, - nodeScoreFunc = null, - depth = 0, - triangle = _triangle, - cachedBox1 = _cachedBox1, - cachedBox2 = _cachedBox2 - ) { - - // Define these inside the function so it has access to the local variables needed - // when converting to the buffer equivalents - function getLeftOffsetBuffer( stride4Offset ) { - - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + this._roots = buildPackedTree( geometry, options ); - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { + if ( ! geometry.boundingBox && options.setBoundingBox ) { - /* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2; + geometry.boundingBox = this.getBoundingBox( new Box3() ); } - return /* node offset */ uint32Array[ stride4Offset + 6 ]; - } - function getRightEndOffsetBuffer( stride4Offset ) { - - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + // retain references to the geometry so we can use them it without having to + // take a geometry reference in every function. + this.geometry = geometry; - while ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) { + } - /* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2; + refit( nodeIndices = null, terminationIndices = null ) { - } + if ( nodeIndices && Array.isArray( nodeIndices ) ) { - return /* node offset */ uint32Array[ stride4Offset + 6 ] + /* node count */ uint16Array[ stride2Offset + 14 ]; + nodeIndices = new Set( nodeIndices ); } - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf && intersectsTriangleFunc ) { - - const geometry = mesh.geometry; - const offset = /* node offset */ uint32Array[ stride4Offset + 6 ]; - const count = /* node count */ uint16Array[ stride2Offset + 14 ]; - return iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle ); - - } else { - - const left = /* node left */ stride4Offset + 8; - const right = /* node right */ uint32Array[ stride4Offset + 6 ]; - let c1 = left; - let c2 = right; - - let score1, score2; - let box1, box2; - if ( nodeScoreFunc ) { - - box1 = cachedBox1; - box2 = cachedBox2; - - arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); - arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); - - score1 = nodeScoreFunc( box1 ); - score2 = nodeScoreFunc( box2 ); - - if ( score2 < score1 ) { - - c1 = right; - c2 = left; - - const temp = score1; - score1 = score2; - score2 = temp; - - box1 = box2; - // box2 is always set before use below - - } - - } - - // Check box 1 intersection - if ( ! box1 ) { - - box1 = cachedBox1; - arrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 ); - - } - - const isC1Leaf = ! /* c1 count */ ( uint16Array[ c1 + 15 ] !== 0xffff ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 ); - - let c1StopTraversal; - if ( c1Intersection === CONTAINED ) { - - const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c1 ); - const end = getRightEndOffsetBuffer( c1 ); - const count = end - offset; - - c1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); + if ( terminationIndices && Array.isArray( terminationIndices ) ) { - } else { - - c1StopTraversal = - c1Intersection && - shapecastBuffer( - c1, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc, - nodeScoreFunc, - depth + 1, - triangle, - cachedBox1, - cachedBox2 - ); - - } - - if ( c1StopTraversal ) return true; - - // Check box 2 intersection - // cached box2 will have been overwritten by previous traversal - box2 = cachedBox2; - arrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 ); - - const isC2Leaf = ! /* c2 count */ ( uint16Array[ c2 + 15 ] !== 0xffff ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 ); - - let c2StopTraversal; - if ( c2Intersection === CONTAINED ) { - - const geometry = mesh.geometry; - const offset = getLeftOffsetBuffer( c2 ); - const end = getRightEndOffsetBuffer( c2 ); - const count = end - offset; - - c2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle ); - - } else { - - c2StopTraversal = - c2Intersection && - shapecastBuffer( - c2, - mesh, - intersectsBoundsFunc, - intersectsTriangleFunc, - nodeScoreFunc, - depth + 1, - triangle, - cachedBox1, - cachedBox2 - ); - - } - - if ( c2StopTraversal ) return true; - - return false; + terminationIndices = new Set( terminationIndices ); } - }; - -} )(); - -const intersectsGeometryBuffer = ( function () { - - const triangle = new SeparatingAxisTriangle(); - const triangle2 = new SeparatingAxisTriangle(); - const cachedMesh = new Mesh(); - const invertedMat = new Matrix4(); - - const obb = new OrientedBox(); - const obb2 = new OrientedBox(); - - return function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) { + const geometry = this.geometry; + const indexArr = geometry.index.array; + const posArr = geometry.attributes.position.array; + let buffer, uint32Array, uint16Array, float32Array; + const roots = this._roots; + for ( let i = 0, l = roots.length; i < l; i ++ ) { - let stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; - - if ( cachedObb === null ) { - - if ( ! geometry.boundingBox ) { - - geometry.computeBoundingBox(); - - } - - obb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh ); - obb.update(); - cachedObb = obb; + buffer = roots[ i ]; + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + float32Array = new Float32Array( buffer ); + _traverse( 0 ); } - const isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ); - if ( isLeaf ) { + function _traverse( node32Index, force = false ) { - const thisGeometry = mesh.geometry; - const thisIndex = thisGeometry.index; - const thisPos = thisGeometry.attributes.position; + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; + if ( isLeaf ) { - const index = geometry.index; - const pos = geometry.attributes.position; + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; - const offset = /* node offset */ uint32Array[ stride4Offset + 6 ]; - const count = /* node count */ uint16Array[ stride2Offset + 14 ]; + let minx = Infinity; + let miny = Infinity; + let minz = Infinity; + let maxx = - Infinity; + let maxy = - Infinity; + let maxz = - Infinity; + for ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) { - // get the inverse of the geometry matrix so we can transform our triangles into the - // geometry space we're trying to test. We assume there are fewer triangles being checked - // here. - invertedMat.copy( geometryToBvh ).invert(); + const index3 = indexArr[ i ] * 3; + const x = posArr[ index3 + 0 ]; + const y = posArr[ index3 + 1 ]; + const z = posArr[ index3 + 2 ]; - if ( geometry.boundsTree ) { + if ( x < minx ) minx = x; + if ( x > maxx ) maxx = x; - arrayToBoxBuffer( /* node boundingData */ stride4Offset, float32Array, obb2 ); - obb2.matrix.copy( invertedMat ); - obb2.update(); + if ( y < miny ) miny = y; + if ( y > maxy ) maxy = y; - cachedMesh.geometry = geometry; - const res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) { + if ( z < minz ) minz = z; + if ( z > maxz ) maxz = z; - tri.a.applyMatrix4( geometryToBvh ); - tri.b.applyMatrix4( geometryToBvh ); - tri.c.applyMatrix4( geometryToBvh ); - tri.update(); + } - for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + if ( + float32Array[ node32Index + 0 ] !== minx || + float32Array[ node32Index + 1 ] !== miny || + float32Array[ node32Index + 2 ] !== minz || - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle2, i, thisIndex, thisPos ); - triangle2.update(); - if ( tri.intersectsTriangle( triangle2 ) ) { + float32Array[ node32Index + 3 ] !== maxx || + float32Array[ node32Index + 4 ] !== maxy || + float32Array[ node32Index + 5 ] !== maxz + ) { - return true; + float32Array[ node32Index + 0 ] = minx; + float32Array[ node32Index + 1 ] = miny; + float32Array[ node32Index + 2 ] = minz; - } + float32Array[ node32Index + 3 ] = maxx; + float32Array[ node32Index + 4 ] = maxy; + float32Array[ node32Index + 5 ] = maxz; - } + return true; - return false; + } else { - } ); - cachedMesh.geometry = null; + return false; - return res; + } } else { - for ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) { - - // this triangle needs to be transformed into the current BVH coordinate frame - setTriangle( triangle, i, thisIndex, thisPos ); - triangle.a.applyMatrix4( invertedMat ); - triangle.b.applyMatrix4( invertedMat ); - triangle.c.applyMatrix4( invertedMat ); - triangle.update(); - - for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + const left = node32Index + 8; + const right = uint32Array[ node32Index + 6 ]; - setTriangle( triangle2, i2, index, pos ); - triangle2.update(); + let leftChange = false; + let forceLeft = force || terminationIndices && terminationIndices.has( left ); + let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true ); + if ( traverseLeft ) { - if ( triangle.intersectsTriangle( triangle2 ) ) { - - return true; - - } - - } + leftChange = _traverse( left, forceLeft ); } - } - - } else { - - const left = /* node left */ stride4Offset + 8; - const right = /* node right */ uint32Array[ stride4Offset + 6 ]; - - arrayToBoxBuffer( /* left boundingData */ left, float32Array, boundingBox$1 ); - const leftIntersection = - cachedObb.intersectsBox( boundingBox$1 ) && - intersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb ); - - if ( leftIntersection ) return true; - - arrayToBoxBuffer( /* right boundingData */ right, float32Array, boundingBox$1 ); - const rightIntersection = - cachedObb.intersectsBox( boundingBox$1 ) && - intersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb ); - - if ( rightIntersection ) return true; - - return false; - - } - - }; - -} )(); - -function intersectRayBuffer( stride4Offset, array, ray, target ) { - - arrayToBoxBuffer( stride4Offset, array, boundingBox$1 ); - return ray.intersectBox( boundingBox$1, target ); - -} - -const bufferStack = []; -let _prevBuffer; -let _float32Array; -let _uint16Array; -let _uint32Array; -function setBuffer( buffer ) { - - if ( _prevBuffer ) { + let rightChange = false; + let forceRight = force || terminationIndices && terminationIndices.has( right ); + let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true ); + if ( traverseRight ) { - bufferStack.push( _prevBuffer ); - - } - - _prevBuffer = buffer; - _float32Array = new Float32Array( buffer ); - _uint16Array = new Uint16Array( buffer ); - _uint32Array = new Uint32Array( buffer ); - -} - -function clearBuffer() { - - _prevBuffer = null; - _float32Array = null; - _uint16Array = null; - _uint32Array = null; - - if ( bufferStack.length ) { - - setBuffer( bufferStack.pop() ); - - } - -} - -function arrayToBoxBuffer( stride4Offset, array, target ) { - - target.min.x = array[ stride4Offset ]; - target.min.y = array[ stride4Offset + 1 ]; - target.min.z = array[ stride4Offset + 2 ]; - - target.max.x = array[ stride4Offset + 3 ]; - target.max.y = array[ stride4Offset + 4 ]; - target.max.z = array[ stride4Offset + 5 ]; - -} + rightChange = _traverse( right, forceRight ); -// boundingData : 6 float32 -// right / offset : 1 uint32 -// splitAxis / isLeaf + count : 1 uint32 / 2 uint16 -const BYTES_PER_NODE = 6 * 4 + 4 + 4; -const IS_LEAFNODE_FLAG = 0xFFFF; -const SKIP_GENERATION = Symbol( 'skip tree generation' ); - -const obb = new OrientedBox(); -const temp = new Vector3(); -const tri2 = new SeparatingAxisTriangle(); -const temp1 = new Vector3(); -const temp2 = new Vector3(); - -class MeshBVH { - - static serialize( bvh, geometry, copyIndexBuffer = true ) { - - function finishTree( node ) { - - if ( node.continueGeneration ) { - - node.continueGeneration(); - - } - - if ( ! node.count ) { + } - finishTree( node.left ); - finishTree( node.right ); + const didChange = leftChange || rightChange; - } + if ( didChange ) { - } + for ( let i = 0; i < 3; i ++ ) { - function countNodes( node ) { + const lefti = left + i; + const righti = right + i; + const minLeftValue = float32Array[ lefti ]; + const maxLeftValue = float32Array[ lefti + 3 ]; + const minRightValue = float32Array[ righti ]; + const maxRightValue = float32Array[ righti + 3 ]; - if ( node.count ) { + float32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue; + float32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue; - return 1; + } - } else { + } - return 1 + countNodes( node.left ) + countNodes( node.right ); + return didChange; } } - function populateBuffer( byteOffset, node ) { + } - const stride4Offset = byteOffset / 4; - const stride2Offset = byteOffset / 2; - const isLeaf = ! ! node.count; - const boundingData = node.boundingData; - for ( let i = 0; i < 6; i ++ ) { + traverse( callback, rootIndex = 0 ) { - float32Array[ stride4Offset + i ] = boundingData[ i ]; + const buffer = this._roots[ rootIndex ]; + const uint32Array = new Uint32Array( buffer ); + const uint16Array = new Uint16Array( buffer ); + _traverse( 0 ); - } + function _traverse( node32Index, depth = 0 ) { + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; if ( isLeaf ) { - const offset = node.offset; - const count = node.count; - uint32Array[ stride4Offset + 6 ] = offset; - uint16Array[ stride2Offset + 14 ] = count; - uint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG; - return byteOffset + BYTES_PER_NODE; + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; + callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count ); } else { - const left = node.left; - const right = node.right; - const splitAxis = node.splitAxis; + const left = node32Index + BYTES_PER_NODE / 4; + const right = uint32Array[ node32Index + 6 ]; + const splitAxis = uint32Array[ node32Index + 7 ]; + const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis ); - let nextUnusedPointer; - nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); + if ( ! stopTraversal ) { - uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; - nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); - - uint32Array[ stride4Offset + 7 ] = splitAxis; - return nextUnusedPointer; - - } + _traverse( left, depth + 1 ); + _traverse( right, depth + 1 ); - } - - let float32Array; - let uint32Array; - let uint16Array; - - const roots = bvh._roots; - let rootData; - - if ( bvh._isPacked ) { - - rootData = roots; - - } else { - - rootData = []; - for ( let i = 0; i < roots.length; i ++ ) { - - const root = roots[ i ]; - finishTree( root ); - let nodeCount = countNodes( root ); - - const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); - float32Array = new Float32Array( buffer ); - uint32Array = new Uint32Array( buffer ); - uint16Array = new Uint16Array( buffer ); - populateBuffer( 0, root ); - rootData.push( buffer ); + } } } - const indexAttribute = geometry.getIndex(); - const result = { - roots: rootData, - index: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array, - }; - - return result; - } - static deserialize( data, geometry, setIndex = true ) { - - const { index, roots } = data; - const bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } ); - bvh._roots = roots; - bvh._isPacked = true; - - if ( setIndex ) { - - const indexAttribute = geometry.getIndex(); - if ( indexAttribute === null ) { - - const newIndex = new BufferAttribute( data.index, 1, false ); - geometry.setIndex( newIndex ); - - } else if ( indexAttribute.array !== index ) { + /* Core Cast Functions */ + raycast( mesh, raycaster, ray, intersects ) { - indexAttribute.array.set( index ); - indexAttribute.needsUpdate = true; + const geometry = this.geometry; + for ( const root of this._roots ) { - } + setBuffer( root ); + raycast( 0, mesh, geometry, raycaster, ray, intersects ); + clearBuffer(); } - return bvh; - } - constructor( geo, options = {} ) { - - if ( ! geo.isBufferGeometry ) { - - throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); - - } else if ( geo.attributes.position.isInterleavedBufferAttribute ) { - - throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); - - } else if ( geo.index && geo.index.isInterleavedBufferAttribute ) { - - throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); - - } - - // default options - options = Object.assign( { - - strategy: CENTER, - maxDepth: 40, - maxLeafTris: 10, - verbose: true, - lazyGeneration: true, - - // undocumented options - - // whether to the pack the data as a buffer or not. The data - // will not be packed if lazyGeneration is true. - packData: true, - - // Whether to skip generating the tree. Used for deserialization. - [ SKIP_GENERATION ]: false + raycastFirst( mesh, raycaster, ray ) { - }, options ); - options.strategy = Math.max( 0, Math.min( 2, options.strategy ) ); + const geometry = this.geometry; + let closestResult = null; + for ( const root of this._roots ) { - this._isPacked = false; - this._roots = null; - if ( ! options[ SKIP_GENERATION ] ) { + setBuffer( root ); + const result = raycastFirst( 0, mesh, geometry, raycaster, ray ); + clearBuffer(); - this._roots = buildTree( geo, options ); - if ( ! options.lazyGeneration && options.packData ) { + if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { - this._roots = MeshBVH.serialize( this, geo, false ).roots; - this._isPacked = true; + closestResult = result; } } - } - - traverse( callback, rootIndex = 0 ) { - - if ( this._isPacked ) { - const buffer = this._roots[ rootIndex ]; - const uint32Array = new Uint32Array( buffer ); - const uint16Array = new Uint16Array( buffer ); - _traverseBuffer( 0 ); - - function _traverseBuffer( stride4Offset, depth = 0 ) { - - const stride2Offset = stride4Offset * 2; - const isLeaf = uint16Array[ stride2Offset + 15 ]; - if ( isLeaf ) { - - const offset = uint32Array[ stride4Offset + 6 ]; - const count = uint16Array[ stride2Offset + 14 ]; - callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count ); + return closestResult; - } else { + } - const left = stride4Offset + BYTES_PER_NODE / 4; - const right = uint32Array[ stride4Offset + 6 ]; - const splitAxis = uint32Array[ stride4Offset + 7 ]; - const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis, false ); + intersectsGeometry( mesh, otherGeometry, geomToMesh ) { - if ( ! stopTraversal ) { + const geometry = this.geometry; + let result = false; + for ( const root of this._roots ) { - _traverseBuffer( left, depth + 1 ); - _traverseBuffer( right, depth + 1 ); + setBuffer( root ); + result = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh ); + clearBuffer(); - } + if ( result ) { - } + break; } - } else { - - _traverseNode( this._roots[ rootIndex ] ); + } - function _traverseNode( node, depth = 0 ) { + return result; - const isLeaf = ! ! node.count; - if ( isLeaf ) { + } - callback( depth, isLeaf, node.boundingData, node.offset, node.count ); + shapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) { - } else { + const geometry = this.geometry; + if ( callbacks instanceof Function ) { - const stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis, ! ! node.continueGeneration ); + if ( _intersectsTriangleFunc ) { - if ( ! stopTraversal ) { + // Support the previous function signature that provided three sequential index buffer + // indices here. + const originalTriangleFunc = _intersectsTriangleFunc; + _intersectsTriangleFunc = ( tri, index, contained, depth ) => { - if ( node.left ) _traverseNode( node.left, depth + 1 ); - if ( node.right ) _traverseNode( node.right, depth + 1 ); + const i3 = index * 3; + return originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth ); - } + }; - } } - } - - } + callbacks = { - /* Core Cast Functions */ - raycast( mesh, raycaster, ray, intersects ) { + boundsTraverseOrder: _orderNodesFunc, + intersectsBounds: callbacks, + intersectsTriangle: _intersectsTriangleFunc, + intersectsRange: null, - const isPacked = this._isPacked; - for ( const root of this._roots ) { - - if ( isPacked ) { - - setBuffer( root ); - raycastBuffer( 0, mesh, raycaster, ray, intersects ); - - } else { - - raycast( root, mesh, raycaster, ray, intersects ); + }; - } + console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' ); } - isPacked && clearBuffer(); + let { + boundsTraverseOrder, + intersectsBounds, + intersectsRange, + intersectsTriangle, + } = callbacks; - } + if ( intersectsRange && intersectsTriangle ) { - raycastFirst( mesh, raycaster, ray ) { - - const isPacked = this._isPacked; - let closestResult = null; - for ( const root of this._roots ) { + const originalIntersectsRange = intersectsRange; + intersectsRange = ( offset, count, contained, depth, nodeIndex ) => { - let result; - if ( isPacked ) { - - setBuffer( root ); - result = raycastFirstBuffer( 0, mesh, raycaster, ray ); - - } else { + if ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) { - result = raycastFirst( root, mesh, raycaster, ray ); + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); - } - - if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { - - closestResult = result; - - } - - } + } - isPacked && clearBuffer(); + return true; - return closestResult; + }; - } + } else if ( ! intersectsRange ) { - intersectsGeometry( mesh, geometry, geomToMesh ) { + if ( intersectsTriangle ) { - const isPacked = this._isPacked; - let result = false; - for ( const root of this._roots ) { + intersectsRange = ( offset, count, contained, depth ) => { - if ( isPacked ) { + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); - setBuffer( root ); - result = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh ); + }; } else { - result = intersectsGeometry( root, mesh, geometry, geomToMesh ); - - } + intersectsRange = ( offset, count, contained ) => { - if ( result ) { + return contained; - break; + }; } } - isPacked && clearBuffer(); - - return result; - - } - - shapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) { - - const isPacked = this._isPacked; let result = false; for ( const root of this._roots ) { - if ( isPacked ) { - - setBuffer( root ); - result = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); - - } else { - - result = shapecast( root, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc ); - - } + setBuffer( root ); + result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder ); + clearBuffer(); if ( result ) { @@ -3325,8 +2947,6 @@ class MeshBVH { } - isPacked && clearBuffer(); - return result; } @@ -3339,8 +2959,10 @@ class MeshBVH { return this.shapecast( mesh, - box => obb.intersectsBox( box ), - tri => obb.intersectsTriangle( tri ) + { + intersectsBounds: box => obb.intersectsBox( box ), + intersectsTriangle: tri => obb.intersectsTriangle( tri ) + } ); } @@ -3349,25 +2971,27 @@ class MeshBVH { return this.shapecast( mesh, - box => sphere.intersectsBox( box ), - tri => tri.intersectsSphere( sphere ) + { + intersectsBounds: box => sphere.intersectsBox( box ), + intersectsTriangle: tri => tri.intersectsSphere( sphere ) + } ); } - closestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { + closestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { - if ( ! geom.boundingBox ) { + if ( ! otherGeometry.boundingBox ) { - geom.computeBoundingBox(); + otherGeometry.computeBoundingBox(); } - obb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh ); + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); obb.update(); - const pos = geom.attributes.position; - const index = geom.index; + const pos = otherGeometry.attributes.position; + const index = otherGeometry.index; let tempTarget1 = null; let tempTarget2 = null; @@ -3386,66 +3010,80 @@ class MeshBVH { let closestDistance = Infinity; this.shapecast( mesh, - ( box, isLeaf, score ) => score < closestDistance && score < maxThreshold, - tri => { + { - if ( tri.needsUpdate ) { + boundsTraverseOrder: box => { - tri.update(); + return obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ); - } + }, - const sphere1 = tri.sphere; - for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + intersectsBounds: ( box, isLeaf, score ) => { - setTriangle( tri2, i2, index, pos ); - tri2.a.applyMatrix4( geometryToBvh ); - tri2.b.applyMatrix4( geometryToBvh ); - tri2.c.applyMatrix4( geometryToBvh ); - tri2.sphere.setFromPoints( tri2.points ); + return score < closestDistance && score < maxThreshold; - const sphere2 = tri2.sphere; - const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; - if ( sphereDist > closestDistance ) { + }, - continue; + intersectsTriangle: tri => { + + if ( tri.needsUpdate ) { + + tri.update(); } - tri2.update(); + const sphere1 = tri.sphere; + for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { - const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); - if ( dist < closestDistance ) { + setTriangle( tri2, i2, index, pos ); + tri2.a.applyMatrix4( geometryToBvh ); + tri2.b.applyMatrix4( geometryToBvh ); + tri2.c.applyMatrix4( geometryToBvh ); + tri2.sphere.setFromPoints( tri2.points ); - if ( target1 ) { + const sphere2 = tri2.sphere; + const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; + if ( sphereDist > closestDistance ) { - target1.copy( tempTarget1 ); + continue; } - if ( target2 ) { + tri2.update(); - target2.copy( tempTarget2 ); + const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); + if ( dist < closestDistance ) { - } + if ( target1 ) { - closestDistance = dist; + target1.copy( tempTarget1 ); - } + } - // stop traversal if we find a point that's under the given threshold - if ( dist < minThreshold ) { + if ( target2 ) { - return true; + target2.copy( tempTarget2 ); + + } + + closestDistance = dist; + + } + + // stop traversal if we find a point that's under the given threshold + if ( dist < minThreshold ) { + + return true; + + } } - } + return false; - return false; + } - }, - box => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ) + } ); @@ -3465,43 +3103,60 @@ class MeshBVH { // skip checking if over maxThreshold // set minThreshold = maxThreshold to quickly check if a point is within a threshold // returns Infinity if no value found - let closestDistance = Infinity; + const minThresholdSq = minThreshold * minThreshold; + const maxThresholdSq = maxThreshold * maxThreshold; + let closestDistanceSq = Infinity; this.shapecast( mesh, - ( box, isLeaf, score ) => score < closestDistance && score < maxThreshold, - tri => { + { - tri.closestPointToPoint( point, temp ); - const dist = point.distanceTo( temp ); - if ( dist < closestDistance ) { + boundsTraverseOrder: box => { - if ( target ) { + temp.copy( point ).clamp( box.min, box.max ); + return temp.distanceToSquared( point ); - target.copy( temp ); + }, - } + intersectsBounds: ( box, isLeaf, score ) => { - closestDistance = dist; + return score < closestDistanceSq && score < maxThresholdSq; - } + }, - if ( dist < minThreshold ) { + intersectsTriangle: tri => { - return true; + tri.closestPointToPoint( point, temp ); + const distSq = point.distanceToSquared( temp ); + if ( distSq < closestDistanceSq ) { - } else { + if ( target ) { - return false; + target.copy( temp ); - } + } + + closestDistanceSq = distSq; + + } + + if ( distSq < minThresholdSq ) { + + return true; + + } else { + + return false; + + } + + }, - }, - box => box.distanceToPoint( point ) + } ); - return closestDistance; + return Math.sqrt( closestDistanceSq ); } @@ -3511,11 +3166,27 @@ class MeshBVH { } + getBoundingBox( target ) { + + target.makeEmpty(); + + const roots = this._roots; + roots.forEach( buffer => { + + arrayToBox$1( 0, new Float32Array( buffer ), tempBox ); + target.union( tempBox ); + + } ); + + return target; + + } + } const wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } ); const boxGeom = new Box3Helper().geometry; -let boundingBox$2 = new Box3(); +let boundingBox$1 = new Box3(); class MeshBVHRootVisualizer extends Group { @@ -3524,9 +3195,7 @@ class MeshBVHRootVisualizer extends Group { super( 'MeshBVHRootVisualizer' ); this.depth = depth; - this._oldDepth = - 1; this.mesh = mesh; - this._boundsTree = null; this._group = group; this.update(); @@ -3535,13 +3204,11 @@ class MeshBVHRootVisualizer extends Group { update() { - this._oldDepth = this.depth; - this._boundsTree = this.mesh.geometry.boundsTree; - + const boundsTree = this.mesh.geometry.boundsTree; let requiredChildren = 0; - if ( this._boundsTree ) { + if ( boundsTree ) { - this._boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { + boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { let isTerminal = isLeaf || countOrIsUnfinished; @@ -3564,9 +3231,9 @@ class MeshBVHRootVisualizer extends Group { } requiredChildren ++; - arrayToBox( boundingData, boundingBox$2 ); - boundingBox$2.getCenter( m.position ); - m.scale.subVectors( boundingBox$2.max, boundingBox$2.min ).multiplyScalar( 0.5 ); + arrayToBox( boundingData, boundingBox$1 ); + boundingBox$1.getCenter( m.position ); + m.scale.subVectors( boundingBox$1.max, boundingBox$1.min ).multiplyScalar( 0.5 ); if ( m.scale.x === 0 ) m.scale.x = Number.EPSILON; if ( m.scale.y === 0 ) m.scale.y = Number.EPSILON; @@ -3620,6 +3287,7 @@ class MeshBVHVisualizer extends Group { let root = this._roots[ i ]; root.depth = this.depth; + root.mesh = this.mesh; root.update(); } @@ -3691,7 +3359,7 @@ function getRootExtremes( bvh, group ) { splits: [ 0, 0, 0 ] }; - bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { + bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => { result.total ++; if ( isLeaf ) { @@ -3699,8 +3367,8 @@ function getRootExtremes( bvh, group ) { result.depth.min = Math.min( depth, result.depth.min ); result.depth.max = Math.max( depth, result.depth.max ); - result.tris.min = Math.min( countOrIsUnfinished, result.tris.min ); - result.tris.max = Math.max( countOrIsUnfinished, result.tris.max ); + result.tris.min = Math.min( count, result.tris.min ); + result.tris.max = Math.max( count, result.tris.max ); } else { @@ -3968,4 +3636,4 @@ function disposeBoundsTree() { } export { MeshBVH, MeshBVHVisualizer as Visualizer, MeshBVHVisualizer, MeshBVHDebug, acceleratedRaycast, computeBoundsTree, disposeBoundsTree, CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED, estimateMemoryInBytes, getBVHExtremes }; -//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.module.js.map diff --git a/build/index.module.js.map b/build/index.module.js.map new file mode 100644 index 000000000..34d489f6d --- /dev/null +++ b/build/index.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.module.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["arrayToBox","xyzFields","boundingBox"],"mappings":";;AAAA;AACA,AAAY,MAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,MAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,MAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,MAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,MAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,MAAC,SAAS,GAAG,CAAC;;ACL1B,MAAM,WAAW,CAAC;;CAEjB,WAAW,GAAG;;;;;EAKb;;CAED;;ACXD;AACA,AAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEhC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAElC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;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AE,IAAI,EAAE,OAAO,EAAE,CAAC;CAC/C,OAAO,IAAI,CAAC,UAAU,CAAC;;CAEvB;;AAED,SAAS,iBAAiB,GAAG;;CAE5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAEvB;;;;"} \ No newline at end of file diff --git a/umd/index.js b/build/index.umd.js similarity index 99% rename from umd/index.js rename to build/index.umd.js index 7cb3b1cc5..f130b7717 100644 --- a/umd/index.js +++ b/build/index.umd.js @@ -3658,4 +3658,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); })); -//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.umd.js.map diff --git a/build/index.umd.js.map b/build/index.umd.js.map new file mode 100644 index 000000000..bf47ee628 --- /dev/null +++ b/build/index.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.umd.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAA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AAE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/index.js.map b/esm/index.js.map deleted file mode 100644 index 45351893e..000000000 --- a/esm/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/castFunctions.js","../src/castFunctionsBuffer.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tif ( lazyGeneration ) {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData );\r\n\t\t\t\tleft.continueGeneration = function () {\r\n\r\n\t\t\t\t\tdelete this.continueGeneration;\r\n\t\t\t\t\tgetCentroidBounds( triangleBounds, lstart, lcount, cacheCentroidBoundingData );\r\n\t\t\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tif ( lazyGeneration ) {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData );\r\n\t\t\t\tright.continueGeneration = function () {\r\n\r\n\t\t\t\t\tdelete this.continueGeneration;\r\n\t\t\t\t\tgetCentroidBounds( triangleBounds, rstart, rcount, cacheCentroidBoundingData );\r\n\t\t\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tconst lazyGeneration = options.lazyGeneration;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// if the geometry doesn't have a bounding box, then let's politely populate it using\r\n\t// the work we did to determine the BVH root bounds\r\n\tif ( geo.boundingBox == null ) {\r\n\r\n\t\tconst rootBox = new Box3();\r\n\t\tgeo.boundingBox = new Box3();\r\n\r\n\t\tfor ( let root of roots ) {\r\n\r\n\t\t\tgeo.boundingBox.union( arrayToBox( root.boundingData, rootBox ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nfunction intersectRay( node, ray, target ) {\r\n\r\n\tarrayToBox( node.boundingData, boundingBox );\r\n\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nexport function raycast( node, mesh, raycaster, ray, intersects ) {\r\n\r\n\tif ( node.continueGeneration ) {\r\n\r\n\t\tnode.continueGeneration();\r\n\r\n\t}\r\n\r\n\tconst isLeaf = ! ! node.count;\r\n\tif ( isLeaf ) {\r\n\r\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, node.offset, node.count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tif ( intersectRay( node.left, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( node.left, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tif ( intersectRay( node.right, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( node.right, mesh, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( node, mesh, raycaster, ray ) {\r\n\r\n\tif ( node.continueGeneration ) {\r\n\r\n\t\tnode.continueGeneration();\r\n\r\n\t}\r\n\r\n\tconst isLeaf = ! ! node.count;\r\n\tif ( isLeaf ) {\r\n\r\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, node.offset, node.count );\r\n\r\n\t} else {\r\n\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = node.splitAxis;\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = node.left;\r\n\t\t\tc2 = node.right;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = node.right;\r\n\t\t\tc2 = node.left;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= c2.boundingData[ splitAxis ] :\r\n\t\t\t\tpoint >= c2.boundingData[ splitAxis + 3 ];\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\r\n\r\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\r\n\r\n\t\t\t\treturn true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\treturn function shapecast(\r\n\t\tnode,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc = null,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( node ) {\r\n\r\n\t\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t}\r\n\r\n\t\t\twhile ( ! node.count ) {\r\n\r\n\t\t\t\tnode = node.left;\r\n\t\t\t\tif ( /* skip */ node.continueGeneration ) {\r\n\r\n\t\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn node.offset;\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( node ) {\r\n\r\n\t\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t}\r\n\r\n\t\t\twhile ( ! node.count ) {\r\n\r\n\t\t\t\tnode = node.right;\r\n\t\t\t\tif ( /* skip */ node.continueGeneration ) {\r\n\r\n\t\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn node.offset + node.count;\r\n\r\n\t\t}\r\n\r\n\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\tnode.continueGeneration();\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tif ( isLeaf && intersectsTriangleFunc ) {\r\n\r\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\tarrayToBox( c1.boundingData, box1 );\r\n\t\t\t\tarrayToBox( c2.boundingData, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1.boundingData, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ! ! c1.count;\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2.boundingData, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ! ! c2.count;\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( node, mesh, geometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\tnode.continueGeneration();\r\n\r\n\t\t}\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! geometry.boundingBox ) {\r\n\r\n\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( geometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( node.boundingData, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\r\n\r\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\r\n\t\t\tarrayToBox( left.boundingData, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\r\n\t\t\tarrayToBox( right.boundingData, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","\n/**************************************************************************************************\n *\n * This file is generated from castFunctions.js and scripts/generate-cast-function.mjs. Do not edit.\n *\n *************************************************************************************************/\n\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\n\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\n\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\n\nexport function raycastBuffer( stride4Offset, mesh, raycaster, ray, intersects ) {\n\n\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\tif ( isLeaf ) {\n\n\t\tintersectTris( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ], intersects );\n\n\t} else {\n\n\t\tif ( intersectRayBuffer( /* node left */ stride4Offset + 8, float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycastBuffer( /* node left */ stride4Offset + 8, mesh, raycaster, ray, intersects );\n\n\t\t}\n\n\t\tif ( intersectRayBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycastBuffer( /* node right */ uint32Array[ stride4Offset + 6 ], mesh, raycaster, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nexport function raycastFirstBuffer( stride4Offset, mesh, raycaster, ray ) {\n\n\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\tif ( isLeaf ) {\n\n\t\treturn intersectClosestTri( mesh, mesh.geometry, raycaster, ray, /* node offset */ uint32Array[ stride4Offset + 6 ], /* node count */ uint16Array[ stride2Offset + 14 ] );\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = /* node splitAxis */ uint32Array[ stride4Offset + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = /* node left */ stride4Offset + 8;\r\n\t\t\tc2 = /* node right */ uint32Array[ stride4Offset + 6 ];\n\n\t\t} else {\n\n\t\t\tc1 = /* node right */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tc2 = /* node left */ stride4Offset + 8;\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRayBuffer( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirstBuffer( c1, mesh, raycaster, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= /* c2 boundingData */ float32Array[ c2 + splitAxis ] :\r\n\t\t\t\tpoint >= /* c2 boundingData */ float32Array[ c2 + splitAxis + 3 ];\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRayBuffer( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirstBuffer( c2, mesh, raycaster, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nexport const shapecastBuffer = ( function () {\n\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\n\n\tfunction iterateOverTriangles(\r\n\t\toffset,\r\n\t\tcount,\r\n\t\tgeometry,\r\n\t\tintersectsTriangleFunc,\r\n\t\tcontained,\r\n\t\tdepth,\r\n\t\ttriangle\r\n\t) {\n\n\t\tconst index = geometry.index;\r\n\t\tconst pos = geometry.attributes.position;\r\n\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\tsetTriangle( triangle, i, index, pos );\r\n\t\t\ttriangle.needsUpdate = true;\n\n\t\t\tif ( intersectsTriangleFunc( triangle, i, i + 1, i + 2, contained, depth ) ) {\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\treturn function shapecastBuffer( stride4Offset,\r\n\t\tmesh,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsTriangleFunc = null,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\n\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffsetBuffer( stride4Offset ) {\n\n\t\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\twhile ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) {\n\n\t\t\t\t/* node */ stride4Offset = /* node left */ stride4Offset + 8, stride2Offset = stride4Offset * 2;\n\n\t\t\t}\n\n\t\t\treturn /* node offset */ uint32Array[ stride4Offset + 6 ];\n\n\t\t}\n\n\t\tfunction getRightEndOffsetBuffer( stride4Offset ) {\n\n\t\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\twhile ( /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff ) ) {\n\n\t\t\t\t/* node */ stride4Offset = /* node right */ uint32Array[ stride4Offset + 6 ], stride2Offset = stride4Offset * 2;\n\n\t\t\t}\n\n\t\t\treturn /* node offset */ uint32Array[ stride4Offset + 6 ] + /* node count */ uint16Array[ stride2Offset + 14 ];\n\n\t\t}\n\n\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\t\tif ( isLeaf && intersectsTriangleFunc ) {\n\n\t\t\tconst geometry = mesh.geometry;\r\n\t\t\tconst offset = /* node offset */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tconst count = /* node count */ uint16Array[ stride2Offset + 14 ];\r\n\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, false, depth, triangle );\n\n\t\t} else {\n\n\t\t\tconst left = /* node left */ stride4Offset + 8;\r\n\t\t\tconst right = /* node right */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\n\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\n\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\n\n\t\t\t\tarrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 );\r\n\t\t\t\tarrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 );\n\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\n\n\t\t\t\tif ( score2 < score1 ) {\n\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\n\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\n\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\n\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBoxBuffer( /* c1 boundingData */ c1, float32Array, box1 );\n\n\t\t\t}\n\n\t\t\tconst isC1Leaf = ! /* c1 count */ ( uint16Array[ c1 + 15 ] !== 0xffff );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1 );\n\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\n\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffsetBuffer( c1 );\r\n\t\t\t\tconst end = getRightEndOffsetBuffer( c1 );\r\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc1StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\n\n\t\t\t} else {\n\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecastBuffer(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c1StopTraversal ) return true;\n\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBoxBuffer( /* c2 boundingData */ c2, float32Array, box2 );\n\n\t\t\tconst isC2Leaf = ! /* c2 count */ ( uint16Array[ c2 + 15 ] !== 0xffff );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1 );\n\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\n\n\t\t\t\tconst geometry = mesh.geometry;\r\n\t\t\t\tconst offset = getLeftOffsetBuffer( c2 );\r\n\t\t\t\tconst end = getRightEndOffsetBuffer( c2 );\r\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc2StopTraversal = iterateOverTriangles( offset, count, geometry, intersectsTriangleFunc, true, depth + 1, triangle );\n\n\t\t\t} else {\n\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecastBuffer(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsTriangleFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c2StopTraversal ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nexport const intersectsGeometryBuffer = ( function () {\n\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\n\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\n\n\treturn function intersectsGeometryBuffer( stride4Offset, mesh, geometry, geometryToBvh, cachedObb = null ) {\n\n\t\tlet stride2Offset = stride4Offset * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tif ( cachedObb === null ) {\n\n\t\t\tif ( ! geometry.boundingBox ) {\n\n\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\tobb.set( geometry.boundingBox.min, geometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\n\n\t\t}\n\n\t\tconst isLeaf = ! /* node count */ ( uint16Array[ stride2Offset + 15 ] !== 0xffff );\r\n\t\tif ( isLeaf ) {\n\n\t\t\tconst thisGeometry = mesh.geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst pos = geometry.attributes.position;\n\n\t\t\tconst offset = /* node offset */ uint32Array[ stride4Offset + 6 ];\r\n\t\t\tconst count = /* node count */ uint16Array[ stride2Offset + 14 ];\n\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\t\tif ( geometry.boundsTree ) {\n\n\t\t\t\tarrayToBoxBuffer( /* node boundingData */ stride4Offset, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\n\n\t\t\t\tcachedMesh.geometry = geometry;\r\n\t\t\t\tconst res = geometry.boundsTree.shapecast( cachedMesh, box => obb2.intersectsBox( box ), function ( tri ) {\n\n\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri.update();\n\n\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\n\n\t\t\t\treturn res;\n\n\t\t\t} else {\n\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\n\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\n\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\n\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = /* node left */ stride4Offset + 8;\r\n\t\t\tconst right = /* node right */ uint32Array[ stride4Offset + 6 ];\n\n\t\t\tarrayToBoxBuffer( /* left boundingData */ left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometryBuffer( left, mesh, geometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( leftIntersection ) return true;\n\n\t\t\tarrayToBoxBuffer( /* right boundingData */ right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometryBuffer( right, mesh, geometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( rightIntersection ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nfunction intersectRayBuffer( stride4Offset, array, ray, target ) {\n\n\tarrayToBoxBuffer( stride4Offset, array, boundingBox );\n\treturn ray.intersectBox( boundingBox, target );\n\n}\n\nconst bufferStack = [];\nlet _prevBuffer;\nlet _float32Array;\nlet _uint16Array;\nlet _uint32Array;\nexport function setBuffer( buffer ) {\n\n\tif ( _prevBuffer ) {\n\n\t\tbufferStack.push( _prevBuffer );\n\n\t}\n\n\t_prevBuffer = buffer;\n\t_float32Array = new Float32Array( buffer );\n\t_uint16Array = new Uint16Array( buffer );\n\t_uint32Array = new Uint32Array( buffer );\n\n}\n\nexport function clearBuffer() {\n\n\t_prevBuffer = null;\n\t_float32Array = null;\n\t_uint16Array = null;\n\t_uint32Array = null;\n\n\tif ( bufferStack.length ) {\n\n\t\tsetBuffer( bufferStack.pop() );\n\n\t}\n\n}\n\nfunction arrayToBoxBuffer( stride4Offset, array, target ) {\n\n\ttarget.min.x = array[ stride4Offset ];\n\ttarget.min.y = array[ stride4Offset + 1 ];\n\ttarget.min.z = array[ stride4Offset + 2 ];\n\n\ttarget.max.x = array[ stride4Offset + 3 ];\n\ttarget.max.y = array[ stride4Offset + 4 ];\n\ttarget.max.z = array[ stride4Offset + 5 ];\n\n}\n","import { Vector3, BufferAttribute } from 'three';\r\nimport { CENTER } from './Constants.js';\r\nimport { buildTree } from './buildFunctions.js';\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport {\r\n\traycast,\r\n\traycastFirst,\r\n\tshapecast,\r\n\tintersectsGeometry,\r\n} from './castFunctions.js';\r\n\r\nimport {\r\n\traycastBuffer,\r\n\traycastFirstBuffer,\r\n\tshapecastBuffer,\r\n\tintersectsGeometryBuffer,\r\n\tsetBuffer,\r\n\tclearBuffer,\r\n} from './castFunctionsBuffer.js';\r\n\r\n// boundingData \t\t\t\t: 6 float32\r\n// right / offset \t\t\t\t: 1 uint32\r\n// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\nconst BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\nconst IS_LEAFNODE_FLAG = 0xFFFF;\r\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\r\n\r\nconst obb = new OrientedBox();\r\nconst temp = new Vector3();\r\nconst tri2 = new SeparatingAxisTriangle();\r\nconst temp1 = new Vector3();\r\nconst temp2 = new Vector3();\r\n\r\nexport default class MeshBVH {\r\n\r\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\r\n\r\n\t\tfunction finishTree( node ) {\r\n\r\n\t\t\tif ( node.continueGeneration ) {\r\n\r\n\t\t\t\tnode.continueGeneration();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! node.count ) {\r\n\r\n\t\t\t\tfinishTree( node.left );\r\n\t\t\t\tfinishTree( node.right );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction countNodes( node ) {\r\n\r\n\t\t\tif ( node.count ) {\r\n\r\n\t\t\t\treturn 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\t\tconst stride4Offset = byteOffset / 4;\r\n\t\t\tconst stride2Offset = byteOffset / 2;\r\n\t\t\tconst isLeaf = ! ! node.count;\r\n\t\t\tconst boundingData = node.boundingData;\r\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tconst offset = node.offset;\r\n\t\t\t\tconst count = node.count;\r\n\t\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst left = node.left;\r\n\t\t\t\tconst right = node.right;\r\n\t\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\t\tlet nextUnusedPointer;\r\n\t\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlet float32Array;\r\n\t\tlet uint32Array;\r\n\t\tlet uint16Array;\r\n\r\n\t\tconst roots = bvh._roots;\r\n\t\tlet rootData;\r\n\r\n\t\tif ( bvh._isPacked ) {\r\n\r\n\t\t\trootData = roots;\r\n\r\n\t\t} else {\r\n\r\n\t\t\trootData = [];\r\n\t\t\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\t\t\tconst root = roots[ i ];\r\n\t\t\t\tfinishTree( root );\r\n\t\t\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\t\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\t\t\tfloat32Array = new Float32Array( buffer );\r\n\t\t\t\tuint32Array = new Uint32Array( buffer );\r\n\t\t\t\tuint16Array = new Uint16Array( buffer );\r\n\t\t\t\tpopulateBuffer( 0, root );\r\n\t\t\t\trootData.push( buffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst indexAttribute = geometry.getIndex();\r\n\t\tconst result = {\r\n\t\t\troots: rootData,\r\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\r\n\t\t};\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tstatic deserialize( data, geometry, setIndex = true ) {\r\n\r\n\t\tconst { index, roots } = data;\r\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\r\n\t\tbvh._roots = roots;\r\n\t\tbvh._isPacked = true;\r\n\r\n\t\tif ( setIndex ) {\r\n\r\n\t\t\tconst indexAttribute = geometry.getIndex();\r\n\t\t\tif ( indexAttribute === null ) {\r\n\r\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\r\n\t\t\t\tgeometry.setIndex( newIndex );\r\n\r\n\t\t\t} else if ( indexAttribute.array !== index ) {\r\n\r\n\t\t\t\tindexAttribute.array.set( index );\r\n\t\t\t\tindexAttribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn bvh;\r\n\r\n\t}\r\n\r\n\tconstructor( geo, options = {} ) {\r\n\r\n\t\tif ( ! geo.isBufferGeometry ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\r\n\r\n\t\t} else if ( geo.attributes.position.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\r\n\r\n\t\t} else if ( geo.index && geo.index.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\r\n\r\n\t\t}\r\n\r\n\t\t// default options\r\n\t\toptions = Object.assign( {\r\n\r\n\t\t\tstrategy: CENTER,\r\n\t\t\tmaxDepth: 40,\r\n\t\t\tmaxLeafTris: 10,\r\n\t\t\tverbose: true,\r\n\t\t\tlazyGeneration: true,\r\n\r\n\t\t\t// undocumented options\r\n\r\n\t\t\t// whether to the pack the data as a buffer or not. The data\r\n\t\t\t// will not be packed if lazyGeneration is true.\r\n\t\t\tpackData: true,\r\n\r\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\r\n\t\t\t[ SKIP_GENERATION ]: false\r\n\r\n\t\t}, options );\r\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\r\n\r\n\t\tthis._isPacked = false;\r\n\t\tthis._roots = null;\r\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\r\n\r\n\t\t\tthis._roots = buildTree( geo, options );\r\n\t\t\tif ( ! options.lazyGeneration && options.packData ) {\r\n\r\n\t\t\t\tthis._roots = MeshBVH.serialize( this, geo, false ).roots;\r\n\t\t\t\tthis._isPacked = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverse( callback, rootIndex = 0 ) {\r\n\r\n\t\tif ( this._isPacked ) {\r\n\r\n\t\t\tconst buffer = this._roots[ rootIndex ];\r\n\t\t\tconst uint32Array = new Uint32Array( buffer );\r\n\t\t\tconst uint16Array = new Uint16Array( buffer );\r\n\t\t\t_traverseBuffer( 0 );\r\n\r\n\t\t\tfunction _traverseBuffer( stride4Offset, depth = 0 ) {\r\n\r\n\t\t\t\tconst stride2Offset = stride4Offset * 2;\r\n\t\t\t\tconst isLeaf = uint16Array[ stride2Offset + 15 ];\r\n\t\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t\tconst offset = uint32Array[ stride4Offset + 6 ];\r\n\t\t\t\t\tconst count = uint16Array[ stride2Offset + 14 ];\r\n\t\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), offset, count );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconst left = stride4Offset + BYTES_PER_NODE / 4;\r\n\t\t\t\t\tconst right = uint32Array[ stride4Offset + 6 ];\r\n\t\t\t\t\tconst splitAxis = uint32Array[ stride4Offset + 7 ];\r\n\t\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, stride4Offset * 4, 6 ), splitAxis, false );\r\n\r\n\t\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t\t_traverseBuffer( left, depth + 1 );\r\n\t\t\t\t\t\t_traverseBuffer( right, depth + 1 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_traverseNode( this._roots[ rootIndex ] );\r\n\r\n\t\t\tfunction _traverseNode( node, depth = 0 ) {\r\n\r\n\t\t\t\tconst isLeaf = ! ! node.count;\r\n\t\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t\tcallback( depth, isLeaf, node.boundingData, node.offset, node.count );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconst stopTraversal = callback( depth, isLeaf, node.boundingData, node.splitAxis, ! ! node.continueGeneration );\r\n\r\n\t\t\t\t\tif ( ! stopTraversal ) {\r\n\r\n\t\t\t\t\t\tif ( node.left ) _traverseNode( node.left, depth + 1 );\r\n\t\t\t\t\t\tif ( node.right ) _traverseNode( node.right, depth + 1 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Core Cast Functions */\r\n\traycast( mesh, raycaster, ray, intersects ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\traycastBuffer( 0, mesh, raycaster, ray, intersects );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\traycast( root, mesh, raycaster, ray, intersects );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t}\r\n\r\n\traycastFirst( mesh, raycaster, ray ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tlet closestResult = null;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tlet result;\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\tresult = raycastFirstBuffer( 0, mesh, raycaster, ray );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresult = raycastFirst( root, mesh, raycaster, ray );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\r\n\r\n\t\t\t\tclosestResult = result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t\treturn closestResult;\r\n\r\n\t}\r\n\r\n\tintersectsGeometry( mesh, geometry, geomToMesh ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\tresult = intersectsGeometryBuffer( 0, mesh, geometry, geomToMesh );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresult = intersectsGeometry( root, mesh, geometry, geomToMesh );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tshapecast( mesh, intersectsBoundsFunc, intersectsTriangleFunc = null, orderNodesFunc = null ) {\r\n\r\n\t\tconst isPacked = this._isPacked;\r\n\t\tlet result = false;\r\n\t\tfor ( const root of this._roots ) {\r\n\r\n\t\t\tif ( isPacked ) {\r\n\r\n\t\t\t\tsetBuffer( root );\r\n\t\t\t\tresult = shapecastBuffer( 0, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresult = shapecast( root, mesh, intersectsBoundsFunc, intersectsTriangleFunc, orderNodesFunc );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( result ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisPacked && clearBuffer();\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/* Derived Cast Functions */\r\n\tintersectsBox( mesh, box, boxToMesh ) {\r\n\r\n\t\tobb.set( box.min, box.max, boxToMesh );\r\n\t\tobb.update();\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => obb.intersectsBox( box ),\r\n\t\t\ttri => obb.intersectsTriangle( tri )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsSphere( mesh, sphere ) {\r\n\r\n\t\treturn this.shapecast(\r\n\t\t\tmesh,\r\n\t\t\tbox => sphere.intersectsBox( box ),\r\n\t\t\ttri => tri.intersectsSphere( sphere )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tclosestPointToGeometry( mesh, geom, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\tif ( ! geom.boundingBox ) {\r\n\r\n\t\t\tgeom.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tobb.set( geom.boundingBox.min, geom.boundingBox.max, geometryToBvh );\r\n\t\tobb.update();\r\n\r\n\t\tconst pos = geom.attributes.position;\r\n\t\tconst index = geom.index;\r\n\r\n\t\tlet tempTarget1 = null;\r\n\t\tlet tempTarget2 = null;\r\n\t\tif ( target1 ) {\r\n\r\n\t\t\ttempTarget1 = temp1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( target2 ) {\r\n\r\n\t\t\ttempTarget2 = temp2;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\tif ( tri.needsUpdate ) {\r\n\r\n\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst sphere1 = tri.sphere;\r\n\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\r\n\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\r\n\r\n\t\t\t\t\tconst sphere2 = tri2.sphere;\r\n\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\r\n\t\t\t\t\tif ( sphereDist > closestDistance ) {\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttri2.update();\r\n\r\n\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\r\n\t\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\t\tif ( target1 ) {\r\n\r\n\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( target2 ) {\r\n\r\n\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\r\n\t\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t},\r\n\t\t\tbox => obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\r\n\r\n\t\t// early out if under minThreshold\r\n\t\t// skip checking if over maxThreshold\r\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\r\n\t\t// returns Infinity if no value found\r\n\t\tlet closestDistance = Infinity;\r\n\t\tthis.shapecast(\r\n\r\n\t\t\tmesh,\r\n\t\t\t( box, isLeaf, score ) => score < closestDistance && score < maxThreshold,\r\n\t\t\ttri => {\r\n\r\n\t\t\t\ttri.closestPointToPoint( point, temp );\r\n\t\t\t\tconst dist = point.distanceTo( temp );\r\n\t\t\t\tif ( dist < closestDistance ) {\r\n\r\n\t\t\t\t\tif ( target ) {\r\n\r\n\t\t\t\t\t\ttarget.copy( temp );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tclosestDistance = dist;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( dist < minThreshold ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tbox => box.distanceToPoint( point )\r\n\r\n\t\t);\r\n\r\n\t\treturn closestDistance;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\r\n\r\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\r\n\r\n\t}\r\n\r\n}\r\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis._oldDepth = - 1;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._boundsTree = null;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tthis._oldDepth = this.depth;\r\n\t\tthis._boundsTree = this.mesh.geometry.boundsTree;\r\n\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( this._boundsTree ) {\r\n\r\n\t\t\tthis._boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( countOrIsUnfinished, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( countOrIsUnfinished, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["xyzFields","boundingBox","boxIntersection"],"mappings":";;AAAA;AACA,AAAY,MAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,MAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,MAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,MAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,MAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,MAAC,SAAS,GAAG,CAAC;;ACL1B,MAAM,WAAW,CAAC;;CAEjB,WAAW,GAAG;;;;;EAKb;;CAED;;ACXD;AACA,AAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEhC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAElC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,C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AAC,YAAY,KAAK,IAAI,GAAG;;GAEtC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;GAC1E,KAAK,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;;GAElC,MAAM;;GAEN,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;GAErE;;EAED,MAAM;;EAEN,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;EAExD;;CAED;;AAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAErC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAC/C,OAAO,IAAI,CAAC,UAAU,CAAC;;CAEvB;;AAED,SAAS,iBAAiB,GAAG;;CAE5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAEvB;;;;"} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index d401ca404..06d900e9a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,32 +3,32 @@ export default [ input: './src/index.js', treeshake: false, external: p => /^three/.test( p ), - + output: { - + name: 'MeshBVHLib', extend: true, format: 'umd', - file: './umd/index.js', + file: './build/index.umd.js', sourcemap: true, - + globals: p => /^three/.test( p ) ? 'THREE' : null, - + }, - + }, { input: './src/index.js', treeshake: false, external: p => /^three/.test( p ), - + output: { - + format: 'esm', - file: './esm/index.js', + file: './build/index.module.js', sourcemap: true, - + }, - + } ]; diff --git a/umd/index.js.map b/umd/index.js.map deleted file mode 100644 index eb497466f..000000000 --- a/umd/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,OAAC,SAAS,GAAG,CAAC;;CCL1B,MAAM,WAAW,CAAC;;CAElB,CAAC,WAAW,GAAG;;CAEf;CACA;;CAEA,EAAE;;CAEF,CAAC;;CCXD;AACA,CAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEjC,CAAC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAEnC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACrB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAErB,CAAC,OAAO,GAAG,CAAC;;CAEZ,CAAC;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ject: [PATCH 136/139] update --- example/pointCloudIntersection.js | 52 ++++++++++++++++--------------- src/MeshBVH.js | 2 +- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/example/pointCloudIntersection.js b/example/pointCloudIntersection.js index a9af8788d..41d805a32 100644 --- a/example/pointCloudIntersection.js +++ b/example/pointCloudIntersection.js @@ -150,44 +150,46 @@ window.addEventListener( 'pointermove', ( event ) => { let closestDistance = Infinity; bvhMesh.geometry.boundsTree.shapecast( bvhMesh, - ( box, isLeaf, score ) => { + { + boundsTraverseOrder: box => { - // if we've already found a point that's closer then the full bounds then - // don't traverse further. - if ( score > closestDistance ) { + // traverse the closer bounds first. + return box.distanceToPoint( ray.origin ); - return NOT_INTERSECTED; + }, + intersectsBounds: ( box, isLeaf, score ) => { - } + // if we've already found a point that's closer then the full bounds then + // don't traverse further. + if ( score > closestDistance ) { - box.expandByScalar( localThreshold ); - return ray.intersectsBox( box ) ? INTERSECTED : NOT_INTERSECTED; + return NOT_INTERSECTED; - }, - triangle => { + } - const distancesToRaySq = ray.distanceSqToPoint( triangle.a ); - if ( distancesToRaySq < localThresholdSq ) { + box.expandByScalar( localThreshold ); + return ray.intersectsBox( box ) ? INTERSECTED : NOT_INTERSECTED; - // track the closest found point distance so we can early out traversal and only - // use the closest point along the ray. - const distanceToPoint = ray.origin.distanceTo( triangle.a ); - if ( distanceToPoint < closestDistance ) { + }, + intersectsTriangle: triangle => { - closestDistance = distanceToPoint; - sphereCollision.position.copy( triangle.a ).applyMatrix4( bvhMesh.matrixWorld ); - sphereCollision.visible = true; + const distancesToRaySq = ray.distanceSqToPoint( triangle.a ); + if ( distancesToRaySq < localThresholdSq ) { - } + // track the closest found point distance so we can early out traversal and only + // use the closest point along the ray. + const distanceToPoint = ray.origin.distanceTo( triangle.a ); + if ( distanceToPoint < closestDistance ) { - } + closestDistance = distanceToPoint; + sphereCollision.position.copy( triangle.a ).applyMatrix4( bvhMesh.matrixWorld ); + sphereCollision.visible = true; - }, - box => { + } - // traverse the closer bounds first. - return box.distanceToPoint( ray.origin ); + } + }, } ); diff --git a/src/MeshBVH.js b/src/MeshBVH.js index 4a92acc55..c406e3440 100644 --- a/src/MeshBVH.js +++ b/src/MeshBVH.js @@ -391,7 +391,7 @@ export default class MeshBVH { }; - console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' ); + console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.' ); } From 0d8b9d580be6b6e417d515f036edc65cb101d2ba Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 21 May 2021 12:45:55 -0700 Subject: [PATCH 137/139] npm run build --- build/index.module.js | 42 +- build/index.module.js.map | 2 +- build/index.umd.js | 3675 +++++++++++++++++ build/index.umd.js.map | 2 +- example/bundle/asyncGenerate.4a48c6e8.js | 14 +- example/bundle/asyncGenerate.html | 3 +- example/bundle/characterMovement.725f956b.js | 14 +- example/bundle/collectTriangles.9c45819a.js | 53 +- example/bundle/collectTriangles.html | 3 +- example/bundle/distancecast.4107d8f2.js | 51 +- example/bundle/distancecast.html | 3 +- .../bundle/generateAsync.worker.13d14241.js | 8 +- example/bundle/physics.50b811f1.js | 14 +- .../bundle/pointCloudIntersection.fd058085.js | 26 +- example/bundle/pointCloudIntersection.html | 3 +- example/bundle/randomSampleDebug.32ad2b43.js | 12 +- example/bundle/raycast.88074831.js | 53 +- example/bundle/raycast.html | 3 +- example/bundle/sculpt.493e9c78.js | 53 +- example/bundle/selection.383a520f.js | 14 +- example/bundle/shapecast.b93a7fe2.js | 53 +- 21 files changed, 3900 insertions(+), 201 deletions(-) create mode 100644 build/index.umd.js diff --git a/build/index.module.js b/build/index.module.js index c9d3c96f6..08fd34f0f 100644 --- a/build/index.module.js +++ b/build/index.module.js @@ -2157,6 +2157,7 @@ const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc = null, + nodeIndexByteOffset = 0, // offset for unique node identifier depth = 0, triangle = _triangle, cachedBox1 = _cachedBox1, @@ -2254,7 +2255,7 @@ const shapecast = ( function () { } const isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF ); - const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 ); let c1StopTraversal; if ( c1Intersection === CONTAINED ) { @@ -2263,7 +2264,7 @@ const shapecast = ( function () { const end = getRightEndOffset( c1 ); const count = end - offset; - c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 ); + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1 ); } else { @@ -2276,6 +2277,7 @@ const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, + nodeIndexByteOffset, depth + 1, triangle, cachedBox1, @@ -2292,7 +2294,7 @@ const shapecast = ( function () { arrayToBox$1( c2, float32Array, box2 ); const isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF ); - const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 ); let c2StopTraversal; if ( c2Intersection === CONTAINED ) { @@ -2301,7 +2303,7 @@ const shapecast = ( function () { const end = getRightEndOffset( c2 ); const count = end - offset; - c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 ); + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2 ); } else { @@ -2314,6 +2316,7 @@ const shapecast = ( function () { intersectsBoundsFunc, intersectsRangeFunc, nodeScoreFunc, + nodeIndexByteOffset, depth + 1, triangle, cachedBox1, @@ -2638,6 +2641,7 @@ class MeshBVH { const indexArr = geometry.index.array; const posArr = geometry.attributes.position.array; let buffer, uint32Array, uint16Array, float32Array; + let byteOffset = 0; const roots = this._roots; for ( let i = 0, l = roots.length; i < l; i ++ ) { @@ -2645,11 +2649,13 @@ class MeshBVH { uint32Array = new Uint32Array( buffer ); uint16Array = new Uint16Array( buffer ); float32Array = new Float32Array( buffer ); - _traverse( 0 ); + + _traverse( 0, byteOffset ); + byteOffset += buffer.byteLength; } - function _traverse( node32Index, force = false ) { + function _traverse( node32Index, byteOffset, force = false ) { const node16Index = node32Index * 2; const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; @@ -2713,21 +2719,26 @@ class MeshBVH { const left = node32Index + 8; const right = uint32Array[ node32Index + 6 ]; + // the indentifying node indices provided by the shapecast function include offsets of all + // root buffers to guarantee they're unique between roots so offset left and right indices here. + const offsetLeft = left + byteOffset; + const offsetRight = right + byteOffset; + let leftChange = false; - let forceLeft = force || terminationIndices && terminationIndices.has( left ); - let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true ); + let forceLeft = force || terminationIndices && terminationIndices.has( offsetLeft ); + let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( offsetLeft ) : true ); if ( traverseLeft ) { - leftChange = _traverse( left, forceLeft ); + leftChange = _traverse( left, byteOffset, forceLeft ); } let rightChange = false; - let forceRight = force || terminationIndices && terminationIndices.has( right ); - let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true ); + let forceRight = force || terminationIndices && terminationIndices.has( offsetRight ); + let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( offsetRight ) : true ); if ( traverseRight ) { - rightChange = _traverse( right, forceRight ); + rightChange = _traverse( right, byteOffset, forceRight ); } @@ -2884,7 +2895,7 @@ class MeshBVH { }; - console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' ); + console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.' ); } @@ -2933,10 +2944,11 @@ class MeshBVH { } let result = false; + let byteOffset = 0; for ( const root of this._roots ) { setBuffer( root ); - result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder ); + result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset ); clearBuffer(); if ( result ) { @@ -2945,6 +2957,8 @@ class MeshBVH { } + byteOffset += root.byteLength; + } return result; diff --git a/build/index.module.js.map b/build/index.module.js.map index 34d489f6d..d2760e192 100644 --- a/build/index.module.js.map +++ b/build/index.module.js.map @@ -1 +1 @@ -{"version":3,"file":"index.module.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["arrayToBox","xyzFields","boundingBox"],"mappings":";;AAAA;AACA,AAAY,MAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,MAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,MAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,MAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,MAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,MAAC,SAAS,GAAG,CAAC;;ACL1B,MAAM,WAAW,CAAC;;CAEjB,WAAW,GAAG;;;;;EAKb;;CAED;;ACXD;AACA,AAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEhC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAElC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;CAEpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,C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U,CAAC;;CAEvB;;AAED,SAAS,iBAAiB,GAAG;;CAE5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAEvB;;;;"} \ No newline at end of file +{"version":3,"file":"index.module.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tnodeIndexByteOffset = 0, // offset for unique node identifier\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tnodeIndexByteOffset,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tnodeIndexByteOffset,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tlet byteOffset = 0;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t\t_traverse( 0, byteOffset );\n\t\t\tbyteOffset += buffer.byteLength;\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\t// the indentifying node indices provided by the shapecast function include offsets of all\n\t\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\t\tconst offsetRight = right + byteOffset;\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( offsetLeft );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( offsetLeft ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, byteOffset, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( offsetRight );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( offsetRight ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, byteOffset, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tlet byteOffset = 0;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tbyteOffset += root.byteLength;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["arrayToBox","xyzFields","boundingBox"],"mappings":";;AAAA;AACA,AAAY,MAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,MAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,MAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,MAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,MAAC,WAAW,GAAG,CAAC,CAAC;AAC7B,AAAY,MAAC,SAAS,GAAG,CAAC;;ACL1B,MAAM,WAAW,CAAC;;CAEjB,WAAW,GAAG;;;;;EAKb;;CAED;;ACXD;AACA,AAAO,SAAS,UAAU,EAAE,EAAE,GAAG;;CAEhC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;;CAElC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA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AU,CAAC,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;GAC1E,KAAK,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;;GAElC,MAAM;;GAEN,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;GAErE;;EAED,MAAM;;EAEN,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;EAExD;;CAED;;AAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAErC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAC/C,OAAO,IAAI,CAAC,UAAU,CAAC;;CAEvB;;AAED,SAAS,iBAAiB,GAAG;;CAE5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAEvB;;;;"} \ No newline at end of file diff --git a/build/index.umd.js b/build/index.umd.js new file mode 100644 index 000000000..2e521ca60 --- /dev/null +++ b/build/index.umd.js @@ -0,0 +1,3675 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three')) : + typeof define === 'function' && define.amd ? define(['exports', 'three'], factory) : + (global = global || self, factory(global.MeshBVHLib = global.MeshBVHLib || {}, global.THREE)); +}(this, function (exports, three) { 'use strict'; + + // Split strategy constants + const CENTER = 0; + const AVERAGE = 1; + const SAH = 2; + + const NOT_INTERSECTED = 0; + const INTERSECTED = 1; + const CONTAINED = 2; + + class MeshBVHNode { + + constructor() { + + // internal nodes have boundingData, left, right, and splitAxis + // leaf nodes have offset and count (referring to primitives in the mesh geometry) + + } + + } + + // Returns a Float32Array representing the bounds data for box. + function boxToArray( bx ) { + + const arr = new Float32Array( 6 ); + + arr[ 0 ] = bx.min.x; + arr[ 1 ] = bx.min.y; + arr[ 2 ] = bx.min.z; + + arr[ 3 ] = bx.max.x; + arr[ 4 ] = bx.max.y; + arr[ 5 ] = bx.max.z; + + return arr; + + } + + function arrayToBox( arr, target ) { + + target.min.x = arr[ 0 ]; + target.min.y = arr[ 1 ]; + target.min.z = arr[ 2 ]; + + target.max.x = arr[ 3 ]; + target.max.y = arr[ 4 ]; + target.max.z = arr[ 5 ]; + + return target; + + } + + function getLongestEdgeIndex( bounds ) { + + let splitDimIdx = - 1; + let splitDist = - Infinity; + + for ( let i = 0; i < 3; i ++ ) { + + const dist = bounds[ i + 3 ] - bounds[ i ]; + if ( dist > splitDist ) { + + splitDist = dist; + splitDimIdx = i; + + } + + } + + return splitDimIdx; + + } + + // https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics + const FLOAT32_EPSILON = Math.pow( 2, - 24 ); + const xyzFields = [ 'x', 'y', 'z' ]; + const boxTemp = new three.Box3(); + + function ensureIndex( geo ) { + + if ( ! geo.index ) { + + const vertexCount = geo.attributes.position.count; + const index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount ); + geo.setIndex( new three.BufferAttribute( index, 1 ) ); + + for ( let i = 0; i < vertexCount; i ++ ) { + + index[ i ] = i; + + } + + } + + } + + // Computes the set of { offset, count } ranges which need independent BVH roots. Each + // region in the geometry index that belongs to a different set of material groups requires + // a separate BVH root, so that triangles indices belonging to one group never get swapped + // with triangle indices belongs to another group. For example, if the groups were like this: + // + // [-------------------------------------------------------------] + // |__________________| + // g0 = [0, 20] |______________________||_____________________| + // g1 = [16, 40] g2 = [41, 60] + // + // we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60]. + function getRootIndexRanges( geo ) { + + if ( ! geo.groups || ! geo.groups.length ) { + + return [ { offset: 0, count: geo.index.count / 3 } ]; + + } + + const ranges = []; + const rangeBoundaries = new Set(); + for ( const group of geo.groups ) { + + rangeBoundaries.add( group.start ); + rangeBoundaries.add( group.start + group.count ); + + } + + // note that if you don't pass in a comparator, it sorts them lexicographically as strings :-( + const sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b ); + for ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) { + + const start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ]; + ranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } ); + + } + + return ranges; + + } + + // computes the union of the bounds of all of the given triangles and puts the resulting box in target. If + // centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well. + // These are computed together to avoid redundant accesses to bounds array. + function getBounds( triangleBounds, offset, count, target, centroidTarget = null ) { + + let minx = Infinity; + let miny = Infinity; + let minz = Infinity; + let maxx = - Infinity; + let maxy = - Infinity; + let maxz = - Infinity; + + let cminx = Infinity; + let cminy = Infinity; + let cminz = Infinity; + let cmaxx = - Infinity; + let cmaxy = - Infinity; + let cmaxz = - Infinity; + + const includeCentroid = centroidTarget !== null; + for ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) { + + const cx = triangleBounds[ i + 0 ]; + const hx = triangleBounds[ i + 1 ]; + const lx = cx - hx; + const rx = cx + hx; + if ( lx < minx ) minx = lx; + if ( rx > maxx ) maxx = rx; + if ( includeCentroid && cx < cminx ) cminx = cx; + if ( includeCentroid && cx > cmaxx ) cmaxx = cx; + + const cy = triangleBounds[ i + 2 ]; + const hy = triangleBounds[ i + 3 ]; + const ly = cy - hy; + const ry = cy + hy; + if ( ly < miny ) miny = ly; + if ( ry > maxy ) maxy = ry; + if ( includeCentroid && cy < cminy ) cminy = cy; + if ( includeCentroid && cy > cmaxy ) cmaxy = cy; + + const cz = triangleBounds[ i + 4 ]; + const hz = triangleBounds[ i + 5 ]; + const lz = cz - hz; + const rz = cz + hz; + if ( lz < minz ) minz = lz; + if ( rz > maxz ) maxz = rz; + if ( includeCentroid && cz < cminz ) cminz = cz; + if ( includeCentroid && cz > cmaxz ) cmaxz = cz; + + } + + target[ 0 ] = minx; + target[ 1 ] = miny; + target[ 2 ] = minz; + + target[ 3 ] = maxx; + target[ 4 ] = maxy; + target[ 5 ] = maxz; + + if ( includeCentroid ) { + + centroidTarget[ 0 ] = cminx; + centroidTarget[ 1 ] = cminy; + centroidTarget[ 2 ] = cminz; + + centroidTarget[ 3 ] = cmaxx; + centroidTarget[ 4 ] = cmaxy; + centroidTarget[ 5 ] = cmaxz; + + } + + } + + // A stand alone function for retrieving the centroid bounds. + function getCentroidBounds( triangleBounds, offset, count, centroidTarget ) { + + let cminx = Infinity; + let cminy = Infinity; + let cminz = Infinity; + let cmaxx = - Infinity; + let cmaxy = - Infinity; + let cmaxz = - Infinity; + + for ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) { + + const cx = triangleBounds[ i + 0 ]; + if ( cx < cminx ) cminx = cx; + if ( cx > cmaxx ) cmaxx = cx; + + const cy = triangleBounds[ i + 2 ]; + if ( cy < cminy ) cminy = cy; + if ( cy > cmaxy ) cmaxy = cy; + + const cz = triangleBounds[ i + 4 ]; + if ( cz < cminz ) cminz = cz; + if ( cz > cmaxz ) cmaxz = cz; + + } + + centroidTarget[ 0 ] = cminx; + centroidTarget[ 1 ] = cminy; + centroidTarget[ 2 ] = cminz; + + centroidTarget[ 3 ] = cmaxx; + centroidTarget[ 4 ] = cmaxy; + centroidTarget[ 5 ] = cmaxz; + + } + + + // reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split + // will be on the left and elements on the right side of the split will be on the right. returns the index + // of the first element on the right side, or offset + count if there are no elements on the right side. + function partition( index, triangleBounds, sahPlanes, offset, count, split ) { + + let left = offset; + let right = offset + count - 1; + const pos = split.pos; + const axisOffset = split.axis * 2; + + // hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme + while ( true ) { + + while ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) { + + left ++; + + } + + while ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) { + + right --; + + } + + if ( left < right ) { + + // we need to swap all of the information associated with the triangles at index + // left and right; that's the verts in the geometry index, the bounds, + // and perhaps the SAH planes + + for ( let i = 0; i < 3; i ++ ) { + + let t0 = index[ left * 3 + i ]; + index[ left * 3 + i ] = index[ right * 3 + i ]; + index[ right * 3 + i ] = t0; + + let t1 = triangleBounds[ left * 6 + i * 2 + 0 ]; + triangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ]; + triangleBounds[ right * 6 + i * 2 + 0 ] = t1; + + let t2 = triangleBounds[ left * 6 + i * 2 + 1 ]; + triangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ]; + triangleBounds[ right * 6 + i * 2 + 1 ] = t2; + + } + + if ( sahPlanes ) { + + for ( let i = 0; i < 3; i ++ ) { + + let t = sahPlanes[ i ][ left ]; + sahPlanes[ i ][ left ] = sahPlanes[ i ][ right ]; + sahPlanes[ i ][ right ] = t; + + } + + } + + left ++; + right --; + + } else { + + return left; + + } + + } + + } + + function getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) { + + let axis = - 1; + let pos = 0; + + // Center + if ( strategy === CENTER ) { + + axis = getLongestEdgeIndex( centroidBoundingData ); + if ( axis !== - 1 ) { + + pos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2; + + } + + } else if ( strategy === AVERAGE ) { + + axis = getLongestEdgeIndex( nodeBoundingData ); + if ( axis !== - 1 ) { + + pos = getAverage( triangleBounds, offset, count, axis ); + + } + + } else if ( strategy === SAH ) { + + // Surface Area Heuristic + // In order to make this code more terse, the x, y, and z + // variables of various structures have been stuffed into + // 0, 1, and 2 array indices so they can be easily computed + // and accessed within array iteration + + // Cost values defineed for operations. We're using bounds for traversal, so + // the cost of traversing one more layer is more than intersecting a triangle. + const TRAVERSAL_COST = 3; + const INTERSECTION_COST = 1; + const bb = arrayToBox( nodeBoundingData, boxTemp ); + + // Define the width, height, and depth of the bounds as a box + const dim = [ + bb.max.x - bb.min.x, + bb.max.y - bb.min.y, + bb.max.z - bb.min.z + ]; + const sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] ); + + // Get the precalculated planes based for the triangles we're + // testing here + const filteredLists = [[], [], []]; + for ( let i = offset, end = offset + count; i < end; i ++ ) { + + for ( let v = 0; v < 3; v ++ ) { + + filteredLists[ v ].push( sahPlanes[ v ][ i ] ); + + } + + } + + filteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) ); + + // this bounds surface area, left bound SA, left triangles, right bound SA, right triangles + const getCost = ( sa, sal, nl, sar, nr ) => + TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr ); + + // the cost of _not_ splitting into smaller bounds + const noSplitCost = INTERSECTION_COST * count; + + axis = - 1; + let bestCost = noSplitCost; + for ( let i = 0; i < 3; i ++ ) { + + // o1 and o2 represent the _other_ two axes in the + // the space. So if we're checking the x (0) dimension, + // then o1 and o2 would be y and z (1 and 2) + const o1 = ( i + 1 ) % 3; + const o2 = ( i + 2 ) % 3; + + const bmin = bb.min[ xyzFields[ i ] ]; + const bmax = bb.max[ xyzFields[ i ] ]; + const planes = filteredLists[ i ]; + + // The number of left and right triangles on either side + // given the current split + let nl = 0; + let nr = count; + for ( let p = 0; p < planes.length; p ++ ) { + + const pinfo = planes[ p ]; + + // As the plane moves, we have to increment or decrement the + // number of triangles on either side of the plane + nl ++; + nr --; + + // the distance from the plane to the edge of the broader bounds + const ldim = pinfo.p - bmin; + const rdim = bmax - pinfo.p; + + // same for the other two dimensions + let ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ]; + let ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ]; + + /* + // compute the other bounding planes for the box + // if only the current triangles are considered to + // be in the box + // This is really slow and probably not really worth it + const o1planes = sahPlanes[o1]; + const o2planes = sahPlanes[o2]; + let lmin = Infinity, lmax = -Infinity; + let rmin = Infinity, rmax = -Infinity; + planes.forEach((p, i) => { + const tri2 = p.tri * 2; + const inf1 = o1planes[tri2 + 0]; + const inf2 = o1planes[tri2 + 1]; + if (i <= nl) { + lmin = Math.min(inf1.p, inf2.p, lmin); + lmax = Math.max(inf1.p, inf2.p, lmax); + } + if (i >= nr) { + rmin = Math.min(inf1.p, inf2.p, rmin); + rmax = Math.max(inf1.p, inf2.p, rmax); + } + }) + ldimo1 = Math.min(lmax - lmin, ldimo1); + rdimo1 = Math.min(rmax - rmin, rdimo1); + + planes.forEach((p, i) => { + const tri2 = p.tri * 2; + const inf1 = o2planes[tri2 + 0]; + const inf2 = o2planes[tri2 + 1]; + if (i <= nl) { + lmin = Math.min(inf1.p, inf2.p, lmin); + lmax = Math.max(inf1.p, inf2.p, lmax); + } + if (i >= nr) { + rmin = Math.min(inf1.p, inf2.p, rmin); + rmax = Math.max(inf1.p, inf2.p, rmax); + } + }) + ldimo2 = Math.min(lmax - lmin, ldimo2); + rdimo2 = Math.min(rmax - rmin, rdimo2); + */ + + // surface areas and cost + const sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim ); + const sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim ); + const cost = getCost( sa, sal, nl, sar, nr ); + + if ( cost < bestCost ) { + + axis = i; + pos = pinfo.p; + bestCost = cost; + + } + + } + + } + + } + + return { axis, pos }; + + } + + // returns the average coordinate on the specified axis of the all the provided triangles + function getAverage( triangleBounds, offset, count, axis ) { + + let avg = 0; + for ( let i = offset, end = offset + count; i < end; i ++ ) { + + avg += triangleBounds[ i * 6 + axis * 2 ]; + + } + + return avg / count; + + } + + function computeSAHPlanes( triangleBounds ) { + + const triCount = triangleBounds.length / 6; + const sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ]; + for ( let tri = 0; tri < triCount; tri ++ ) { + + for ( let el = 0; el < 3; el ++ ) { + + sahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri }; + + } + + } + + return sahPlanes; + + } + + // precomputes the bounding box for each triangle; required for quickly calculating tree splits. + // result is an array of size tris.length * 6 where triangle i maps to a + // [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6, + // representing the center and half-extent in each dimension of triangle i + function computeTriangleBounds( geo ) { + + const verts = geo.attributes.position.array; + const index = geo.index.array; + const triCount = index.length / 3; + const triangleBounds = new Float32Array( triCount * 6 ); + + for ( let tri = 0; tri < triCount; tri ++ ) { + + const tri3 = tri * 3; + const tri6 = tri * 6; + const ai = index[ tri3 + 0 ] * 3; + const bi = index[ tri3 + 1 ] * 3; + const ci = index[ tri3 + 2 ] * 3; + + for ( let el = 0; el < 3; el ++ ) { + + const a = verts[ ai + el ]; + const b = verts[ bi + el ]; + const c = verts[ ci + el ]; + + let min = a; + if ( b < min ) min = b; + if ( c < min ) min = c; + + let max = a; + if ( b > max ) max = b; + if ( c > max ) max = c; + + // Increase the bounds size by float32 epsilon to avoid precision errors when + // converting to 32 bit float. Scale the epsilon by the size of the numbers being + // worked with. + const halfExtents = ( max - min ) / 2; + const el2 = el * 2; + triangleBounds[ tri6 + el2 + 0 ] = min + halfExtents; + triangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON; + + } + + } + + return triangleBounds; + + } + + function buildTree( geo, options ) { + + // either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node, + // recording the offset and count of its triangles and writing them into the reordered geometry index. + function splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) { + + if ( ! reachedMaxDepth && depth >= maxDepth ) { + + reachedMaxDepth = true; + if ( verbose ) { + + console.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` ); + console.warn( this, geo ); + + } + + } + + // early out if we've met our capacity + if ( count <= maxLeafTris || depth >= maxDepth ) { + + node.offset = offset; + node.count = count; + return node; + + } + + // Find where to split the volume + const split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ); + if ( split.axis === - 1 ) { + + node.offset = offset; + node.count = count; + return node; + + } + + const splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split ); + + // create the two new child nodes + if ( splitOffset === offset || splitOffset === offset + count ) { + + node.offset = offset; + node.count = count; + + } else { + + node.splitAxis = split.axis; + + // create the left child and compute its bounding box + const left = new MeshBVHNode(); + const lstart = offset; + const lcount = splitOffset - offset; + node.left = left; + left.boundingData = new Float32Array( 6 ); + + getBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData ); + splitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 ); + + // repeat for right + const right = new MeshBVHNode(); + const rstart = splitOffset; + const rcount = count - lcount; + node.right = right; + right.boundingData = new Float32Array( 6 ); + + getBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData ); + splitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 ); + + } + + return node; + + } + + ensureIndex( geo ); + + const cacheCentroidBoundingData = new Float32Array( 6 ); + const triangleBounds = computeTriangleBounds( geo ); + const sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null; + const indexArray = geo.index.array; + const maxDepth = options.maxDepth; + const verbose = options.verbose; + const maxLeafTris = options.maxLeafTris; + const strategy = options.strategy; + let reachedMaxDepth = false; + + const roots = []; + const ranges = getRootIndexRanges( geo ); + + if ( ranges.length === 1 ) { + + const root = new MeshBVHNode(); + const range = ranges[ 0 ]; + + if ( geo.boundingBox != null ) { + + root.boundingData = boxToArray( geo.boundingBox ); + getCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData ); + + } else { + + root.boundingData = new Float32Array( 6 ); + getBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData ); + + } + + splitNode( root, range.offset, range.count, cacheCentroidBoundingData ); + roots.push( root ); + + } else { + + for ( let range of ranges ) { + + const root = new MeshBVHNode(); + root.boundingData = new Float32Array( 6 ); + getBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData ); + + splitNode( root, range.offset, range.count, cacheCentroidBoundingData ); + roots.push( root ); + + } + + } + + return roots; + + } + + const BYTES_PER_NODE = 6 * 4 + 4 + 4; + + const IS_LEAFNODE_FLAG = 0xFFFF; + + function buildPackedTree( geo, options ) { + + // boundingData : 6 float32 + // right / offset : 1 uint32 + // splitAxis / isLeaf + count : 1 uint32 / 2 uint16 + const roots = buildTree( geo, options ); + + let float32Array; + let uint32Array; + let uint16Array; + const packedRoots = []; + for ( let i = 0; i < roots.length; i ++ ) { + + const root = roots[ i ]; + let nodeCount = countNodes( root ); + + const buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount ); + float32Array = new Float32Array( buffer ); + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + populateBuffer( 0, root ); + packedRoots.push( buffer ); + + } + + return packedRoots; + + function countNodes( node ) { + + if ( node.count ) { + + return 1; + + } else { + + return 1 + countNodes( node.left ) + countNodes( node.right ); + + } + + } + + function populateBuffer( byteOffset, node ) { + + const stride4Offset = byteOffset / 4; + const stride2Offset = byteOffset / 2; + const isLeaf = ! ! node.count; + const boundingData = node.boundingData; + for ( let i = 0; i < 6; i ++ ) { + + float32Array[ stride4Offset + i ] = boundingData[ i ]; + + } + + if ( isLeaf ) { + + const offset = node.offset; + const count = node.count; + uint32Array[ stride4Offset + 6 ] = offset; + uint16Array[ stride2Offset + 14 ] = count; + uint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG; + return byteOffset + BYTES_PER_NODE; + + } else { + + const left = node.left; + const right = node.right; + const splitAxis = node.splitAxis; + + let nextUnusedPointer; + nextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left ); + + if ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) { + + throw new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' ); + + } + + uint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4; + nextUnusedPointer = populateBuffer( nextUnusedPointer, right ); + + uint32Array[ stride4Offset + 7 ] = splitAxis; + return nextUnusedPointer; + + } + + } + + } + + class SeparatingAxisBounds { + + constructor() { + + this.min = Infinity; + this.max = - Infinity; + + } + + setFromPointsField( points, field ) { + + let min = Infinity; + let max = - Infinity; + for ( let i = 0, l = points.length; i < l; i ++ ) { + + const p = points[ i ]; + const val = p[ field ]; + min = Math.min( val, min ); + max = Math.max( val, max ); + + } + + this.min = min; + this.max = max; + + + } + + setFromPoints( axis, points ) { + + let min = Infinity; + let max = - Infinity; + for ( let i = 0, l = points.length; i < l; i ++ ) { + + const p = points[ i ]; + const val = axis.dot( p ); + min = Math.min( val, min ); + max = Math.max( val, max ); + + } + + this.min = min; + this.max = max; + + } + + isSeparated( other ) { + + return this.min > other.max || other.min > this.max; + + } + + } + + SeparatingAxisBounds.prototype.setFromBox = ( function () { + + const p = new three.Vector3(); + return function setFromBox( axis, box ) { + + const boxMin = box.min; + const boxMax = box.max; + let min = Infinity; + let max = - Infinity; + for ( let x = 0; x <= 1; x ++ ) { + + for ( let y = 0; y <= 1; y ++ ) { + + for ( let z = 0; z <= 1; z ++ ) { + + p.x = boxMin.x * x + boxMax.x * ( 1 - x ); + p.y = boxMin.y * y + boxMax.y * ( 1 - y ); + p.z = boxMin.z * z + boxMax.z * ( 1 - z ); + + const val = axis.dot( p ); + min = Math.min( val, min ); + max = Math.max( val, max ); + + } + + } + + } + + this.min = min; + this.max = max; + + }; + + } )(); + + const areIntersecting = ( function () { + + const cacheSatBounds = new SeparatingAxisBounds(); + return function areIntersecting( shape1, shape2 ) { + + const points1 = shape1.points; + const satAxes1 = shape1.satAxes; + const satBounds1 = shape1.satBounds; + + const points2 = shape2.points; + const satAxes2 = shape2.satAxes; + const satBounds2 = shape2.satBounds; + + // check axes of the first shape + for ( let i = 0; i < 3; i ++ ) { + + const sb = satBounds1[ i ]; + const sa = satAxes1[ i ]; + cacheSatBounds.setFromPoints( sa, points2 ); + if ( sb.isSeparated( cacheSatBounds ) ) return false; + + } + + // check axes of the second shape + for ( let i = 0; i < 3; i ++ ) { + + const sb = satBounds2[ i ]; + const sa = satAxes2[ i ]; + cacheSatBounds.setFromPoints( sa, points1 ); + if ( sb.isSeparated( cacheSatBounds ) ) return false; + + } + + }; + + } )(); + + const closestPointLineToLine = ( function () { + + // https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56 + const dir1 = new three.Vector3(); + const dir2 = new three.Vector3(); + const v02 = new three.Vector3(); + return function closestPointLineToLine( l1, l2, result ) { + + const v0 = l1.start; + const v10 = dir1; + const v2 = l2.start; + const v32 = dir2; + + v02.subVectors( v0, v2 ); + dir1.subVectors( l1.end, l2.start ); + dir2.subVectors( l2.end, l2.start ); + + // float d0232 = v02.Dot(v32); + const d0232 = v02.dot( v32 ); + + // float d3210 = v32.Dot(v10); + const d3210 = v32.dot( v10 ); + + // float d3232 = v32.Dot(v32); + const d3232 = v32.dot( v32 ); + + // float d0210 = v02.Dot(v10); + const d0210 = v02.dot( v10 ); + + // float d1010 = v10.Dot(v10); + const d1010 = v10.dot( v10 ); + + // float denom = d1010*d3232 - d3210*d3210; + const denom = d1010 * d3232 - d3210 * d3210; + + let d, d2; + if ( denom !== 0 ) { + + d = ( d0232 * d3210 - d0210 * d3232 ) / denom; + + } else { + + d = 0; + + } + + d2 = ( d0232 + d * d3210 ) / d3232; + + result.x = d; + result.y = d2; + + }; + + } )(); + + const closestPointsSegmentToSegment = ( function () { + + // https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187 + const paramResult = new three.Vector2(); + const temp1 = new three.Vector3(); + const temp2 = new three.Vector3(); + return function closestPointsSegmentToSegment( l1, l2, target1, target2 ) { + + closestPointLineToLine( l1, l2, paramResult ); + + let d = paramResult.x; + let d2 = paramResult.y; + if ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) { + + l1.at( d, target1 ); + l2.at( d2, target2 ); + + return; + + } else if ( d >= 0 && d <= 1 ) { + + // Only d2 is out of bounds. + if ( d2 < 0 ) { + + l2.at( 0, target2 ); + + } else { + + l2.at( 1, target2 ); + + } + + l1.closestPointToPoint( target2, true, target1 ); + return; + + } else if ( d2 >= 0 && d2 <= 1 ) { + + // Only d is out of bounds. + if ( d < 0 ) { + + l1.at( 0, target1 ); + + } else { + + l1.at( 1, target1 ); + + } + + l2.closestPointToPoint( target1, true, target2 ); + return; + + } else { + + // Both u and u2 are out of bounds. + let p; + if ( d < 0 ) { + + p = l1.start; + + } else { + + p = l1.end; + + } + + let p2; + if ( d2 < 0 ) { + + p2 = l2.start; + + } else { + + p2 = l2.end; + + } + + const closestPoint = temp1; + const closestPoint2 = temp2; + l1.closestPointToPoint( p2, true, temp1 ); + l2.closestPointToPoint( p, true, temp2 ); + + if ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) { + + target1.copy( closestPoint ); + target2.copy( p2 ); + return; + + } else { + + target1.copy( p ); + target2.copy( closestPoint2 ); + return; + + } + + } + + }; + + } )(); + + + const sphereIntersectTriangle = ( function () { + + // https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js + const closestPointTemp = new three.Vector3(); + const projectedPointTemp = new three.Vector3(); + const planeTemp = new three.Plane(); + const lineTemp = new three.Line3(); + return function sphereIntersectTriangle( sphere, triangle ) { + + const { radius, center } = sphere; + const { a, b, c } = triangle; + + // phase 1 + lineTemp.start = a; + lineTemp.end = b; + const closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp ); + if ( closestPoint1.distanceTo( center ) <= radius ) return true; + + lineTemp.start = a; + lineTemp.end = c; + const closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp ); + if ( closestPoint2.distanceTo( center ) <= radius ) return true; + + lineTemp.start = b; + lineTemp.end = c; + const closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp ); + if ( closestPoint3.distanceTo( center ) <= radius ) return true; + + // phase 2 + const plane = triangle.getPlane( planeTemp ); + const dp = Math.abs( plane.distanceToPoint( center ) ); + if ( dp <= radius ) { + + const pp = plane.projectPoint( center, projectedPointTemp ); + const cp = triangle.containsPoint( pp ); + if ( cp ) return true; + + } + + return false; + + }; + + } )(); + + class SeparatingAxisTriangle extends three.Triangle { + + constructor( ...args ) { + + super( ...args ); + + this.isSeparatingAxisTriangle = true; + this.satAxes = new Array( 4 ).fill().map( () => new three.Vector3() ); + this.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() ); + this.points = [ this.a, this.b, this.c ]; + this.sphere = new three.Sphere(); + this.needsUpdate = false; + + } + + intersectsSphere( sphere ) { + + return sphereIntersectTriangle( sphere, this ); + + } + + } + + SeparatingAxisTriangle.prototype.update = ( function () { + + const arr = new Array( 3 ); + return function update() { + + const a = this.a; + const b = this.b; + const c = this.c; + + arr[ 0 ] = this.a; + arr[ 1 ] = this.b; + arr[ 2 ] = this.c; + + const satAxes = this.satAxes; + const satBounds = this.satBounds; + + const axis0 = satAxes[ 0 ]; + const sab0 = satBounds[ 0 ]; + this.getNormal( axis0 ); + sab0.setFromPoints( axis0, arr ); + + const axis1 = satAxes[ 1 ]; + const sab1 = satBounds[ 1 ]; + axis1.subVectors( a, b ); + sab1.setFromPoints( axis1, arr ); + + const axis2 = satAxes[ 2 ]; + const sab2 = satBounds[ 2 ]; + axis2.subVectors( b, c ); + sab2.setFromPoints( axis2, arr ); + + const axis3 = satAxes[ 3 ]; + const sab3 = satBounds[ 3 ]; + axis3.subVectors( c, a ); + sab3.setFromPoints( axis3, arr ); + + this.sphere.setFromPoints( this.points ); + this.needsUpdate = false; + + }; + + } )(); + + SeparatingAxisTriangle.prototype.closestPointToSegment = ( function () { + + const point1 = new three.Vector3(); + const point2 = new three.Vector3(); + const edge = new three.Line3(); + + return function distanceToSegment( segment, target1 = null, target2 = null ) { + + if ( this.needsUpdate ) { + + this.update(); + + } + + const { start, end } = segment; + const points = this.points; + let distSq; + let closestDistanceSq = Infinity; + + // check the triangle edges + for ( let i = 0; i < 3; i ++ ) { + + const nexti = ( i + 1 ) % 3; + edge.start.copy( points[ i ] ); + edge.end.copy( points[ nexti ] ); + + closestPointsSegmentToSegment( edge, segment, point1, point2 ); + + distSq = point1.distanceToSquared( point2 ); + if ( distSq < closestDistanceSq ) { + + closestDistanceSq = distSq; + if ( target1 ) target1.copy( point1 ); + if ( target2 ) target2.copy( point2 ); + + } + + } + + // check end points + this.closestPointToPoint( start, point1 ); + distSq = start.distanceToSquared( point1 ); + if ( distSq < closestDistanceSq ) { + + closestDistanceSq = distSq; + if ( target1 ) target1.copy( point1 ); + if ( target2 ) target2.copy( start ); + + } + + this.closestPointToPoint( end, point1 ); + distSq = end.distanceToSquared( point1 ); + if ( distSq < closestDistanceSq ) { + + closestDistanceSq = distSq; + if ( target1 ) target1.copy( point1 ); + if ( target2 ) target2.copy( end ); + + } + + return Math.sqrt( closestDistanceSq ); + + }; + + } )(); + + SeparatingAxisTriangle.prototype.intersectsTriangle = ( function () { + + const saTri2 = new SeparatingAxisTriangle(); + const arr1 = new Array( 3 ); + const arr2 = new Array( 3 ); + const cachedSatBounds = new SeparatingAxisBounds(); + const cachedSatBounds2 = new SeparatingAxisBounds(); + const cachedAxis = new three.Vector3(); + return function intersectsTriangle( other ) { + + if ( this.needsUpdate ) { + + this.update(); + + } + + if ( ! other.isSeparatingAxisTriangle ) { + + saTri2.copy( other ); + saTri2.update(); + other = saTri2; + + } + + const satBounds1 = this.satBounds; + const satAxes1 = this.satAxes; + arr2[ 0 ] = other.a; + arr2[ 1 ] = other.b; + arr2[ 2 ] = other.c; + for ( let i = 0; i < 4; i ++ ) { + + const sb = satBounds1[ i ]; + const sa = satAxes1[ i ]; + cachedSatBounds.setFromPoints( sa, arr2 ); + if ( sb.isSeparated( cachedSatBounds ) ) return false; + + } + + const satBounds2 = other.satBounds; + const satAxes2 = other.satAxes; + arr1[ 0 ] = this.a; + arr1[ 1 ] = this.b; + arr1[ 2 ] = this.c; + for ( let i = 0; i < 4; i ++ ) { + + const sb = satBounds2[ i ]; + const sa = satAxes2[ i ]; + cachedSatBounds.setFromPoints( sa, arr1 ); + if ( sb.isSeparated( cachedSatBounds ) ) return false; + + } + + // check crossed axes + for ( let i = 0; i < 4; i ++ ) { + + const sa1 = satAxes1[ i ]; + for ( let i2 = 0; i2 < 4; i2 ++ ) { + + const sa2 = satAxes2[ i2 ]; + cachedAxis.crossVectors( sa1, sa2 ); + cachedSatBounds.setFromPoints( cachedAxis, arr1 ); + cachedSatBounds2.setFromPoints( cachedAxis, arr2 ); + if ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false; + + } + + } + + return true; + + }; + + } )(); + + + SeparatingAxisTriangle.prototype.distanceToPoint = ( function () { + + const target = new three.Vector3(); + return function distanceToPoint( point ) { + + this.closestPointToPoint( point, target ); + return point.distanceTo( target ); + + }; + + } )(); + + + SeparatingAxisTriangle.prototype.distanceToTriangle = ( function () { + + const point = new three.Vector3(); + const point2 = new three.Vector3(); + const cornerFields = [ 'a', 'b', 'c' ]; + const line1 = new three.Line3(); + const line2 = new three.Line3(); + + return function distanceToTriangle( other, target1 = null, target2 = null ) { + + if ( other.needsUpdate ) { + + other.update(); + + } + + if ( this.needsUpdate ) { + + this.update(); + + } + + if ( this.intersectsTriangle( other ) ) { + + // TODO: This will not result in a point that lies on + // the intersection line of the triangles + if ( target1 || target2 ) { + + this.getMidpoint( point ); + other.closestPointToPoint( point, point2 ); + this.closestPointToPoint( point2, point ); + + if ( target1 ) target1.copy( point ); + if ( target2 ) target2.copy( point2 ); + + } + + return 0; + + } + + let closestDistanceSq = Infinity; + + // check all point distances + for ( let i = 0; i < 3; i ++ ) { + + let dist; + const field = cornerFields[ i ]; + const otherVec = other[ field ]; + this.closestPointToPoint( otherVec, point ); + + dist = otherVec.distanceToSquared( point ); + + if ( dist < closestDistanceSq ) { + + closestDistanceSq = dist; + if ( target1 ) target1.copy( point ); + if ( target2 ) target2.copy( otherVec ); + + } + + + const thisVec = this[ field ]; + other.closestPointToPoint( thisVec, point ); + + dist = thisVec.distanceToSquared( point ); + + if ( dist < closestDistanceSq ) { + + closestDistanceSq = dist; + if ( target1 ) target1.copy( thisVec ); + if ( target2 ) target2.copy( point ); + + } + + } + + for ( let i = 0; i < 3; i ++ ) { + + const f11 = cornerFields[ i ]; + const f12 = cornerFields[ ( i + 1 ) % 3 ]; + line1.set( this[ f11 ], this[ f12 ] ); + for ( let i2 = 0; i2 < 3; i2 ++ ) { + + const f21 = cornerFields[ i2 ]; + const f22 = cornerFields[ ( i2 + 1 ) % 3 ]; + line2.set( other[ f21 ], other[ f22 ] ); + + closestPointsSegmentToSegment( line1, line2, point, point2 ); + + const dist = point.distanceToSquared( point2 ); + if ( dist < closestDistanceSq ) { + + closestDistanceSq = dist; + if ( target1 ) target1.copy( point ); + if ( target2 ) target2.copy( point2 ); + + } + + } + + } + + return Math.sqrt( closestDistanceSq ); + + }; + + } )(); + + class OrientedBox extends three.Box3 { + + constructor( ...args ) { + + super( ...args ); + + this.isOrientedBox = true; + this.matrix = new three.Matrix4(); + this.invMatrix = new three.Matrix4(); + this.points = new Array( 8 ).fill().map( () => new three.Vector3() ); + this.satAxes = new Array( 3 ).fill().map( () => new three.Vector3() ); + this.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() ); + this.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() ); + this.sphere = new three.Sphere(); + + } + + set( min, max, matrix ) { + + super.set( min, max ); + this.matrix = matrix; + + } + + copy( other ) { + + super.copy( other ); + this.matrix.copy( other.matrix ); + + } + + } + + OrientedBox.prototype.update = ( function () { + + return function update() { + + const matrix = this.matrix; + const min = this.min; + const max = this.max; + + const points = this.points; + for ( let x = 0; x <= 1; x ++ ) { + + for ( let y = 0; y <= 1; y ++ ) { + + for ( let z = 0; z <= 1; z ++ ) { + + const i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z ); + const v = points[ i ]; + v.x = x ? max.x : min.x; + v.y = y ? max.y : min.y; + v.z = z ? max.z : min.z; + + v.applyMatrix4( matrix ); + + } + + } + + } + + this.sphere.setFromPoints( this.points ); + + const satBounds = this.satBounds; + const satAxes = this.satAxes; + const minVec = points[ 0 ]; + for ( let i = 0; i < 3; i ++ ) { + + const axis = satAxes[ i ]; + const sb = satBounds[ i ]; + const index = 1 << i; + const pi = points[ index ]; + + axis.subVectors( minVec, pi ); + sb.setFromPoints( axis, points ); + + } + + const alignedSatBounds = this.alignedSatBounds; + alignedSatBounds[ 0 ].setFromPointsField( points, 'x' ); + alignedSatBounds[ 1 ].setFromPointsField( points, 'y' ); + alignedSatBounds[ 2 ].setFromPointsField( points, 'z' ); + + this.invMatrix.copy( this.matrix ).invert(); + + }; + + } )(); + + OrientedBox.prototype.intersectsBox = ( function () { + + const aabbBounds = new SeparatingAxisBounds(); + return function intersectsBox( box ) { + + if ( ! box.intersectsSphere( this.sphere ) ) return false; + + const min = box.min; + const max = box.max; + const satBounds = this.satBounds; + const satAxes = this.satAxes; + const alignedSatBounds = this.alignedSatBounds; + + aabbBounds.min = min.x; + aabbBounds.max = max.x; + if ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false; + + aabbBounds.min = min.y; + aabbBounds.max = max.y; + if ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false; + + aabbBounds.min = min.z; + aabbBounds.max = max.z; + if ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false; + + for ( let i = 0; i < 3; i ++ ) { + + const axis = satAxes[ i ]; + const sb = satBounds[ i ]; + aabbBounds.setFromBox( axis, box ); + if ( sb.isSeparated( aabbBounds ) ) return false; + + } + + return true; + + }; + + } )(); + + OrientedBox.prototype.intersectsTriangle = ( function () { + + const saTri = new SeparatingAxisTriangle(); + const pointsArr = new Array( 3 ); + const cachedSatBounds = new SeparatingAxisBounds(); + const cachedSatBounds2 = new SeparatingAxisBounds(); + const cachedAxis = new three.Vector3(); + return function intersectsTriangle( triangle ) { + + if ( ! triangle.isSeparatingAxisTriangle ) { + + saTri.copy( triangle ); + saTri.update(); + triangle = saTri; + + } else if ( triangle.needsUpdate ) { + + triangle.update(); + + } + + const satBounds = this.satBounds; + const satAxes = this.satAxes; + + pointsArr[ 0 ] = triangle.a; + pointsArr[ 1 ] = triangle.b; + pointsArr[ 2 ] = triangle.c; + + for ( let i = 0; i < 3; i ++ ) { + + const sb = satBounds[ i ]; + const sa = satAxes[ i ]; + cachedSatBounds.setFromPoints( sa, pointsArr ); + if ( sb.isSeparated( cachedSatBounds ) ) return false; + + } + + const triSatBounds = triangle.satBounds; + const triSatAxes = triangle.satAxes; + const points = this.points; + for ( let i = 0; i < 3; i ++ ) { + + const sb = triSatBounds[ i ]; + const sa = triSatAxes[ i ]; + cachedSatBounds.setFromPoints( sa, points ); + if ( sb.isSeparated( cachedSatBounds ) ) return false; + + } + + // check crossed axes + for ( let i = 0; i < 3; i ++ ) { + + const sa1 = satAxes[ i ]; + for ( let i2 = 0; i2 < 4; i2 ++ ) { + + const sa2 = triSatAxes[ i2 ]; + cachedAxis.crossVectors( sa1, sa2 ); + cachedSatBounds.setFromPoints( cachedAxis, pointsArr ); + cachedSatBounds2.setFromPoints( cachedAxis, points ); + if ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false; + + } + + } + + return true; + + }; + + } )(); + + OrientedBox.prototype.closestPointToPoint = ( function () { + + return function closestPointToPoint( point, target1 ) { + + target1 + .copy( point ) + .applyMatrix4( this.invMatrix ) + .clamp( this.min, this.max ) + .applyMatrix4( this.matrix ); + + return target1; + + }; + + } )(); + + OrientedBox.prototype.distanceToPoint = ( function () { + + const target = new three.Vector3(); + return function distanceToPoint( point ) { + + this.closestPointToPoint( point, target ); + return point.distanceTo( target ); + + }; + + } )(); + + + OrientedBox.prototype.distanceToBox = ( function () { + + const xyzFields = [ 'x', 'y', 'z' ]; + const segments1 = new Array( 12 ).fill().map( () => new three.Line3() ); + const segments2 = new Array( 12 ).fill().map( () => new three.Line3() ); + + const point1 = new three.Vector3(); + const point2 = new three.Vector3(); + + return function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) { + + if ( this.intersectsBox( box ) ) { + + if ( target1 || target2 ) { + + box.getCenter( point2 ); + this.closestPointToPoint( point2, point1 ); + box.closestPointToPoint( point1, point2 ); + + if ( target1 ) target1.copy( point1 ); + if ( target2 ) target2.copy( point2 ); + + } + return 0; + + } + + const threshold2 = threshold * threshold; + const min = box.min; + const max = box.max; + const points = this.points; + + + // iterate over every edge and compare distances + let closestDistanceSq = Infinity; + + // check over all these points + for ( let i = 0; i < 8; i ++ ) { + + const p = points[ i ]; + point2.copy( p ).clamp( min, max ); + + const dist = p.distanceToSquared( point2 ); + if ( dist < closestDistanceSq ) { + + closestDistanceSq = dist; + if ( target1 ) target1.copy( p ); + if ( target2 ) target2.copy( point2 ); + + if ( dist < threshold2 ) return Math.sqrt( dist ); + + } + + } + + // generate and check all line segment distances + let count = 0; + for ( let i = 0; i < 3; i ++ ) { + + for ( let i1 = 0; i1 <= 1; i1 ++ ) { + + for ( let i2 = 0; i2 <= 1; i2 ++ ) { + + const nextIndex = ( i + 1 ) % 3; + const nextIndex2 = ( i + 2 ) % 3; + + // get obb line segments + const index = i1 << nextIndex | i2 << nextIndex2; + const index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2; + const p1 = points[ index ]; + const p2 = points[ index2 ]; + const line1 = segments1[ count ]; + line1.set( p1, p2 ); + + + // get aabb line segments + const f1 = xyzFields[ i ]; + const f2 = xyzFields[ nextIndex ]; + const f3 = xyzFields[ nextIndex2 ]; + const line2 = segments2[ count ]; + const start = line2.start; + const end = line2.end; + + start[ f1 ] = min[ f1 ]; + start[ f2 ] = i1 ? min[ f2 ] : max[ f2 ]; + start[ f3 ] = i2 ? min[ f3 ] : max[ f2 ]; + + end[ f1 ] = max[ f1 ]; + end[ f2 ] = i1 ? min[ f2 ] : max[ f2 ]; + end[ f3 ] = i2 ? min[ f3 ] : max[ f2 ]; + + count ++; + + } + + } + + } + + // check all the other boxes point + for ( let x = 0; x <= 1; x ++ ) { + + for ( let y = 0; y <= 1; y ++ ) { + + for ( let z = 0; z <= 1; z ++ ) { + + point2.x = x ? max.x : min.x; + point2.y = y ? max.y : min.y; + point2.z = z ? max.z : min.z; + + this.closestPointToPoint( point2, point1 ); + const dist = point2.distanceToSquared( point1 ); + if ( dist < closestDistanceSq ) { + + closestDistanceSq = dist; + if ( target1 ) target1.copy( point1 ); + if ( target2 ) target2.copy( point2 ); + + if ( dist < threshold2 ) return Math.sqrt( dist ); + + } + + } + + } + + } + + for ( let i = 0; i < 12; i ++ ) { + + const l1 = segments1[ i ]; + for ( let i2 = 0; i2 < 12; i2 ++ ) { + + const l2 = segments2[ i2 ]; + closestPointsSegmentToSegment( l1, l2, point1, point2 ); + const dist = point1.distanceToSquared( point2 ); + if ( dist < closestDistanceSq ) { + + closestDistanceSq = dist; + if ( target1 ) target1.copy( point1 ); + if ( target2 ) target2.copy( point2 ); + + if ( dist < threshold2 ) return Math.sqrt( dist ); + + } + + } + + } + + return Math.sqrt( closestDistanceSq ); + + }; + + } )(); + + // sets the vertices of triangle `tri` with the 3 vertices after i + function setTriangle( tri, i, index, pos ) { + + const ta = tri.a; + const tb = tri.b; + const tc = tri.c; + + let i3 = index.getX( i ); + ta.x = pos.getX( i3 ); + ta.y = pos.getY( i3 ); + ta.z = pos.getZ( i3 ); + + i3 = index.getX( i + 1 ); + tb.x = pos.getX( i3 ); + tb.y = pos.getY( i3 ); + tb.z = pos.getZ( i3 ); + + i3 = index.getX( i + 2 ); + tc.x = pos.getX( i3 ); + tc.y = pos.getY( i3 ); + tc.z = pos.getZ( i3 ); + + } + + // Ripped and modified From THREE.js Mesh raycast + // https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115 + var vA = new three.Vector3(); + var vB = new three.Vector3(); + var vC = new three.Vector3(); + + var uvA = new three.Vector2(); + var uvB = new three.Vector2(); + var uvC = new three.Vector2(); + + var intersectionPoint = new three.Vector3(); + var intersectionPointWorld = new three.Vector3(); + + function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) { + + var intersect; + if ( material.side === three.BackSide ) { + + intersect = ray.intersectTriangle( pC, pB, pA, true, point ); + + } else { + + intersect = ray.intersectTriangle( pA, pB, pC, material.side !== three.DoubleSide, point ); + + } + + if ( intersect === null ) return null; + + intersectionPointWorld.copy( point ); + intersectionPointWorld.applyMatrix4( object.matrixWorld ); + + var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld ); + + if ( distance < raycaster.near || distance > raycaster.far ) return null; + + return { + distance: distance, + point: intersectionPointWorld.clone(), + object: object + }; + + } + + function checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) { + + vA.fromBufferAttribute( position, a ); + vB.fromBufferAttribute( position, b ); + vC.fromBufferAttribute( position, c ); + + var intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint ); + + if ( intersection ) { + + if ( uv ) { + + uvA.fromBufferAttribute( uv, a ); + uvB.fromBufferAttribute( uv, b ); + uvC.fromBufferAttribute( uv, c ); + + intersection.uv = three.Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new three.Vector2( ) ); + + } + + const face = { + a: a, + b: b, + c: c, + normal: new three.Vector3( ), + materialIndex: 0 + }; + + three.Triangle.getNormal( vA, vB, vC, face.normal ); + + intersection.face = face; + intersection.faceIndex = a; + + } + + return intersection; + + } + + // https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258 + function intersectTri( mesh, geo, raycaster, ray, tri, intersections ) { + + const triOffset = tri * 3; + const a = geo.index.getX( triOffset ); + const b = geo.index.getX( triOffset + 1 ); + const c = geo.index.getX( triOffset + 2 ); + + const intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c ); + + if ( intersection ) { + + intersection.faceIndex = tri; + if ( intersections ) intersections.push( intersection ); + return intersection; + + } + + return null; + + } + + function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) { + + for ( let i = offset, end = offset + count; i < end; i ++ ) { + + intersectTri( mesh, geo, raycaster, ray, i, intersections ); + + } + + } + + function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) { + + let dist = Infinity; + let res = null; + for ( let i = offset, end = offset + count; i < end; i ++ ) { + + const intersection = intersectTri( mesh, geo, raycaster, ray, i ); + if ( intersection && intersection.distance < dist ) { + + res = intersection; + dist = intersection.distance; + + } + + } + + return res; + + } + + function arrayToBox$1( nodeIndex32, array, target ) { + + target.min.x = array[ nodeIndex32 ]; + target.min.y = array[ nodeIndex32 + 1 ]; + target.min.z = array[ nodeIndex32 + 2 ]; + + target.max.x = array[ nodeIndex32 + 3 ]; + target.max.y = array[ nodeIndex32 + 4 ]; + target.max.z = array[ nodeIndex32 + 5 ]; + + } + + function iterateOverTriangles( + offset, + count, + geometry, + intersectsTriangleFunc, + contained, + depth, + triangle + ) { + + const index = geometry.index; + const pos = geometry.attributes.position; + for ( let i = offset, l = count + offset; i < l; i ++ ) { + + setTriangle( triangle, i * 3, index, pos ); + triangle.needsUpdate = true; + + if ( intersectsTriangleFunc( triangle, i, contained, depth ) ) { + + return true; + + } + + } + + return false; + + } + + /* Generated from "castFunctions.template.js". Do not edit. */ + + const boundingBox = new three.Box3(); + const boxIntersection = new three.Vector3(); + const xyzFields$1 = [ 'x', 'y', 'z' ]; + + function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) { + + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); + if ( isLeaf ) { + + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + + intersectTris( mesh, geometry, raycaster, ray, offset, count, intersects ); + + } else { + + const leftIndex = nodeIndex32 + 8; + if ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) { + + raycast( leftIndex, mesh, geometry, raycaster, ray, intersects ); + + } + + const rightIndex = uint32Array[ nodeIndex32 + 6 ]; + if ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) { + + raycast( rightIndex, mesh, geometry, raycaster, ray, intersects ); + + } + + } + + } + + function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) { + + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); + if ( isLeaf ) { + + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + return intersectClosestTri( mesh, geometry, raycaster, ray, offset, count ); + + } else { + + // consider the position of the split plane with respect to the oncoming ray; whichever direction + // the ray is coming from, look for an intersection among that side of the tree first + const splitAxis = uint32Array[ nodeIndex32 + 7 ]; + const xyzAxis = xyzFields$1[ splitAxis ]; + const rayDir = ray.direction[ xyzAxis ]; + const leftToRight = rayDir >= 0; + + // c1 is the child to check first + let c1, c2; + if ( leftToRight ) { + + c1 = nodeIndex32 + 8; + c2 = uint32Array[ nodeIndex32 + 6 ]; + + } else { + + c1 = uint32Array[ nodeIndex32 + 6 ]; + c2 = nodeIndex32 + 8; + + } + + const c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection ); + const c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null; + + // if we got an intersection in the first node and it's closer than the second node's bounding + // box, we don't need to consider the second node because it couldn't possibly be a better result + if ( c1Result ) { + + // check if the point is within the second bounds + const point = c1Result.point[ xyzAxis ]; + const isOutside = leftToRight ? + point <= float32Array[ c2 + splitAxis ] : // min bounding data + point >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data + + if ( isOutside ) { + + return c1Result; + + } + + } + + // either there was no intersection in the first node, or there could still be a closer + // intersection in the second, so check the second node and then take the better of the two + const c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection ); + const c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null; + + if ( c1Result && c2Result ) { + + return c1Result.distance <= c2Result.distance ? c1Result : c2Result; + + } else { + + return c1Result || c2Result || null; + + } + + } + + } + + const shapecast = ( function () { + + const _triangle = new SeparatingAxisTriangle(); + const _cachedBox1 = new three.Box3(); + const _cachedBox2 = new three.Box3(); + + return function shapecast( + nodeIndex32, + mesh, + geometry, + intersectsBoundsFunc, + intersectsRangeFunc, + nodeScoreFunc = null, + nodeIndexByteOffset = 0, // offset for unique node identifier + depth = 0, + triangle = _triangle, + cachedBox1 = _cachedBox1, + cachedBox2 = _cachedBox2 + ) { + + // Define these inside the function so it has access to the local variables needed + // when converting to the buffer equivalents + function getLeftOffset( nodeIndex32 ) { + + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + + // traverse until we find a leaf + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { + + nodeIndex32 = nodeIndex32 + 8; + nodeIndex16 = nodeIndex32 * 2; + + } + + return uint32Array[ nodeIndex32 + 6 ]; + + } + + function getRightEndOffset( nodeIndex32 ) { + + let nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array; + + // traverse until we find a leaf + while ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) { + + // adjust offset to point to the right node + nodeIndex32 = uint32Array[ nodeIndex32 + 6 ]; + nodeIndex16 = nodeIndex32 * 2; + + } + + // return the end offset of the triangle range + return uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ]; + + } + + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); + if ( isLeaf ) { + + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + return intersectsRangeFunc( offset, count, false, depth, nodeIndex32 ); + + } else { + + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; + let c1 = left; + let c2 = right; + + let score1, score2; + let box1, box2; + if ( nodeScoreFunc ) { + + box1 = cachedBox1; + box2 = cachedBox2; + + // bounding data is not offset + arrayToBox$1( c1, float32Array, box1 ); + arrayToBox$1( c2, float32Array, box2 ); + + score1 = nodeScoreFunc( box1 ); + score2 = nodeScoreFunc( box2 ); + + if ( score2 < score1 ) { + + c1 = right; + c2 = left; + + const temp = score1; + score1 = score2; + score2 = temp; + + box1 = box2; + // box2 is always set before use below + + } + + } + + // Check box 1 intersection + if ( ! box1 ) { + + box1 = cachedBox1; + arrayToBox$1( c1, float32Array, box1 ); + + } + + const isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF ); + const c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 ); + + let c1StopTraversal; + if ( c1Intersection === CONTAINED ) { + + const offset = getLeftOffset( c1 ); + const end = getRightEndOffset( c1 ); + const count = end - offset; + + c1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1 ); + + } else { + + c1StopTraversal = + c1Intersection && + shapecast( + c1, + mesh, + geometry, + intersectsBoundsFunc, + intersectsRangeFunc, + nodeScoreFunc, + nodeIndexByteOffset, + depth + 1, + triangle, + cachedBox1, + cachedBox2 + ); + + } + + if ( c1StopTraversal ) return true; + + // Check box 2 intersection + // cached box2 will have been overwritten by previous traversal + box2 = cachedBox2; + arrayToBox$1( c2, float32Array, box2 ); + + const isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF ); + const c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 ); + + let c2StopTraversal; + if ( c2Intersection === CONTAINED ) { + + const offset = getLeftOffset( c2 ); + const end = getRightEndOffset( c2 ); + const count = end - offset; + + c2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2 ); + + } else { + + c2StopTraversal = + c2Intersection && + shapecast( + c2, + mesh, + geometry, + intersectsBoundsFunc, + intersectsRangeFunc, + nodeScoreFunc, + nodeIndexByteOffset, + depth + 1, + triangle, + cachedBox1, + cachedBox2 + ); + + } + + if ( c2StopTraversal ) return true; + + return false; + + } + + }; + + } )(); + + const intersectsGeometry = ( function () { + + const triangle = new SeparatingAxisTriangle(); + const triangle2 = new SeparatingAxisTriangle(); + const cachedMesh = new three.Mesh(); + const invertedMat = new three.Matrix4(); + + const obb = new OrientedBox(); + const obb2 = new OrientedBox(); + + return function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) { + + let nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array; + + if ( cachedObb === null ) { + + if ( ! otherGeometry.boundingBox ) { + + otherGeometry.computeBoundingBox(); + + } + + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); + obb.update(); + cachedObb = obb; + + } + + const isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ); + if ( isLeaf ) { + + const thisGeometry = geometry; + const thisIndex = thisGeometry.index; + const thisPos = thisGeometry.attributes.position; + + const index = otherGeometry.index; + const pos = otherGeometry.attributes.position; + + const offset = uint32Array[ nodeIndex32 + 6 ]; + const count = uint16Array[ nodeIndex16 + 14 ]; + + // get the inverse of the geometry matrix so we can transform our triangles into the + // geometry space we're trying to test. We assume there are fewer triangles being checked + // here. + invertedMat.copy( geometryToBvh ).invert(); + + if ( otherGeometry.boundsTree ) { + + arrayToBox$1( nodeIndex32, float32Array, obb2 ); + obb2.matrix.copy( invertedMat ); + obb2.update(); + + cachedMesh.geometry = otherGeometry; + const res = otherGeometry.boundsTree.shapecast( cachedMesh, { + + intersectsBounds: box => obb2.intersectsBox( box ), + + intersectsTriangle: tri => { + + tri.a.applyMatrix4( geometryToBvh ); + tri.b.applyMatrix4( geometryToBvh ); + tri.c.applyMatrix4( geometryToBvh ); + tri.update(); + + for ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle2, i, thisIndex, thisPos ); + triangle2.update(); + if ( tri.intersectsTriangle( triangle2 ) ) { + + return true; + + } + + } + + return false; + + } + + } ); + cachedMesh.geometry = null; + + return res; + + } else { + + for ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) { + + // this triangle needs to be transformed into the current BVH coordinate frame + setTriangle( triangle, i, thisIndex, thisPos ); + triangle.a.applyMatrix4( invertedMat ); + triangle.b.applyMatrix4( invertedMat ); + triangle.c.applyMatrix4( invertedMat ); + triangle.update(); + + for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + + setTriangle( triangle2, i2, index, pos ); + triangle2.update(); + + if ( triangle.intersectsTriangle( triangle2 ) ) { + + return true; + + } + + } + + } + + } + + } else { + + const left = nodeIndex32 + 8; + const right = uint32Array[ nodeIndex32 + 6 ]; + + arrayToBox$1( left, float32Array, boundingBox ); + const leftIntersection = + cachedObb.intersectsBox( boundingBox ) && + intersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); + + if ( leftIntersection ) return true; + + arrayToBox$1( right, float32Array, boundingBox ); + const rightIntersection = + cachedObb.intersectsBox( boundingBox ) && + intersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb ); + + if ( rightIntersection ) return true; + + return false; + + } + + }; + + } )(); + + function intersectRay( nodeIndex32, array, ray, target ) { + + arrayToBox$1( nodeIndex32, array, boundingBox ); + return ray.intersectBox( boundingBox, target ); + + } + + const bufferStack = []; + let _prevBuffer; + let _float32Array; + let _uint16Array; + let _uint32Array; + function setBuffer( buffer ) { + + if ( _prevBuffer ) { + + bufferStack.push( _prevBuffer ); + + } + + _prevBuffer = buffer; + _float32Array = new Float32Array( buffer ); + _uint16Array = new Uint16Array( buffer ); + _uint32Array = new Uint32Array( buffer ); + + } + + function clearBuffer() { + + _prevBuffer = null; + _float32Array = null; + _uint16Array = null; + _uint32Array = null; + + if ( bufferStack.length ) { + + setBuffer( bufferStack.pop() ); + + } + + } + + const SKIP_GENERATION = Symbol( 'skip tree generation' ); + + const obb = new OrientedBox(); + const temp = new three.Vector3(); + const tri2 = new SeparatingAxisTriangle(); + const temp1 = new three.Vector3(); + const temp2 = new three.Vector3(); + const tempBox = new three.Box3(); + const triangle = new SeparatingAxisTriangle(); + + class MeshBVH { + + static serialize( bvh, geometry, copyIndexBuffer = true ) { + + const rootData = bvh._roots; + const indexAttribute = geometry.getIndex(); + const result = { + roots: rootData, + index: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array, + }; + + return result; + + } + + static deserialize( data, geometry, setIndex = true ) { + + const { index, roots } = data; + const bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } ); + bvh._roots = roots; + + if ( setIndex ) { + + const indexAttribute = geometry.getIndex(); + if ( indexAttribute === null ) { + + const newIndex = new three.BufferAttribute( data.index, 1, false ); + geometry.setIndex( newIndex ); + + } else if ( indexAttribute.array !== index ) { + + indexAttribute.array.set( index ); + indexAttribute.needsUpdate = true; + + } + + } + + return bvh; + + } + + constructor( geometry, options = {} ) { + + if ( ! geometry.isBufferGeometry ) { + + throw new Error( 'MeshBVH: Only BufferGeometries are supported.' ); + + } else if ( geometry.attributes.position.isInterleavedBufferAttribute ) { + + throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' ); + + } else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) { + + throw new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' ); + + } + + // default options + options = Object.assign( { + + strategy: CENTER, + maxDepth: 40, + maxLeafTris: 10, + verbose: true, + + setBoundingBox: true, + + // undocumented options + + // Whether to skip generating the tree. Used for deserialization. + [ SKIP_GENERATION ]: false + + }, options ); + options.strategy = Math.max( 0, Math.min( 2, options.strategy ) ); + + this._roots = null; + if ( ! options[ SKIP_GENERATION ] ) { + + this._roots = buildPackedTree( geometry, options ); + + if ( ! geometry.boundingBox && options.setBoundingBox ) { + + geometry.boundingBox = this.getBoundingBox( new three.Box3() ); + + } + + } + + // retain references to the geometry so we can use them it without having to + // take a geometry reference in every function. + this.geometry = geometry; + + } + + refit( nodeIndices = null, terminationIndices = null ) { + + if ( nodeIndices && Array.isArray( nodeIndices ) ) { + + nodeIndices = new Set( nodeIndices ); + + } + + if ( terminationIndices && Array.isArray( terminationIndices ) ) { + + terminationIndices = new Set( terminationIndices ); + + } + + const geometry = this.geometry; + const indexArr = geometry.index.array; + const posArr = geometry.attributes.position.array; + let buffer, uint32Array, uint16Array, float32Array; + let byteOffset = 0; + const roots = this._roots; + for ( let i = 0, l = roots.length; i < l; i ++ ) { + + buffer = roots[ i ]; + uint32Array = new Uint32Array( buffer ); + uint16Array = new Uint16Array( buffer ); + float32Array = new Float32Array( buffer ); + + _traverse( 0, byteOffset ); + byteOffset += buffer.byteLength; + + } + + function _traverse( node32Index, byteOffset, force = false ) { + + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; + if ( isLeaf ) { + + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; + + let minx = Infinity; + let miny = Infinity; + let minz = Infinity; + let maxx = - Infinity; + let maxy = - Infinity; + let maxz = - Infinity; + for ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) { + + const index3 = indexArr[ i ] * 3; + const x = posArr[ index3 + 0 ]; + const y = posArr[ index3 + 1 ]; + const z = posArr[ index3 + 2 ]; + + if ( x < minx ) minx = x; + if ( x > maxx ) maxx = x; + + if ( y < miny ) miny = y; + if ( y > maxy ) maxy = y; + + if ( z < minz ) minz = z; + if ( z > maxz ) maxz = z; + + } + + if ( + float32Array[ node32Index + 0 ] !== minx || + float32Array[ node32Index + 1 ] !== miny || + float32Array[ node32Index + 2 ] !== minz || + + float32Array[ node32Index + 3 ] !== maxx || + float32Array[ node32Index + 4 ] !== maxy || + float32Array[ node32Index + 5 ] !== maxz + ) { + + float32Array[ node32Index + 0 ] = minx; + float32Array[ node32Index + 1 ] = miny; + float32Array[ node32Index + 2 ] = minz; + + float32Array[ node32Index + 3 ] = maxx; + float32Array[ node32Index + 4 ] = maxy; + float32Array[ node32Index + 5 ] = maxz; + + return true; + + } else { + + return false; + + } + + } else { + + const left = node32Index + 8; + const right = uint32Array[ node32Index + 6 ]; + + // the indentifying node indices provided by the shapecast function include offsets of all + // root buffers to guarantee they're unique between roots so offset left and right indices here. + const offsetLeft = left + byteOffset; + const offsetRight = right + byteOffset; + + let leftChange = false; + let forceLeft = force || terminationIndices && terminationIndices.has( offsetLeft ); + let traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( offsetLeft ) : true ); + if ( traverseLeft ) { + + leftChange = _traverse( left, byteOffset, forceLeft ); + + } + + let rightChange = false; + let forceRight = force || terminationIndices && terminationIndices.has( offsetRight ); + let traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( offsetRight ) : true ); + if ( traverseRight ) { + + rightChange = _traverse( right, byteOffset, forceRight ); + + } + + const didChange = leftChange || rightChange; + + if ( didChange ) { + + for ( let i = 0; i < 3; i ++ ) { + + const lefti = left + i; + const righti = right + i; + const minLeftValue = float32Array[ lefti ]; + const maxLeftValue = float32Array[ lefti + 3 ]; + const minRightValue = float32Array[ righti ]; + const maxRightValue = float32Array[ righti + 3 ]; + + float32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue; + float32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue; + + } + + } + + return didChange; + + } + + } + + } + + traverse( callback, rootIndex = 0 ) { + + const buffer = this._roots[ rootIndex ]; + const uint32Array = new Uint32Array( buffer ); + const uint16Array = new Uint16Array( buffer ); + _traverse( 0 ); + + function _traverse( node32Index, depth = 0 ) { + + const node16Index = node32Index * 2; + const isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG; + if ( isLeaf ) { + + const offset = uint32Array[ node32Index + 6 ]; + const count = uint16Array[ node16Index + 14 ]; + callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count ); + + } else { + + const left = node32Index + BYTES_PER_NODE / 4; + const right = uint32Array[ node32Index + 6 ]; + const splitAxis = uint32Array[ node32Index + 7 ]; + const stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis ); + + if ( ! stopTraversal ) { + + _traverse( left, depth + 1 ); + _traverse( right, depth + 1 ); + + } + + } + + } + + } + + /* Core Cast Functions */ + raycast( mesh, raycaster, ray, intersects ) { + + const geometry = this.geometry; + for ( const root of this._roots ) { + + setBuffer( root ); + raycast( 0, mesh, geometry, raycaster, ray, intersects ); + clearBuffer(); + + } + + } + + raycastFirst( mesh, raycaster, ray ) { + + const geometry = this.geometry; + let closestResult = null; + for ( const root of this._roots ) { + + setBuffer( root ); + const result = raycastFirst( 0, mesh, geometry, raycaster, ray ); + clearBuffer(); + + if ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) { + + closestResult = result; + + } + + } + + + return closestResult; + + } + + intersectsGeometry( mesh, otherGeometry, geomToMesh ) { + + const geometry = this.geometry; + let result = false; + for ( const root of this._roots ) { + + setBuffer( root ); + result = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh ); + clearBuffer(); + + if ( result ) { + + break; + + } + + } + + return result; + + } + + shapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) { + + const geometry = this.geometry; + if ( callbacks instanceof Function ) { + + if ( _intersectsTriangleFunc ) { + + // Support the previous function signature that provided three sequential index buffer + // indices here. + const originalTriangleFunc = _intersectsTriangleFunc; + _intersectsTriangleFunc = ( tri, index, contained, depth ) => { + + const i3 = index * 3; + return originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth ); + + }; + + + } + + callbacks = { + + boundsTraverseOrder: _orderNodesFunc, + intersectsBounds: callbacks, + intersectsTriangle: _intersectsTriangleFunc, + intersectsRange: null, + + }; + + console.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.' ); + + } + + let { + boundsTraverseOrder, + intersectsBounds, + intersectsRange, + intersectsTriangle, + } = callbacks; + + if ( intersectsRange && intersectsTriangle ) { + + const originalIntersectsRange = intersectsRange; + intersectsRange = ( offset, count, contained, depth, nodeIndex ) => { + + if ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) { + + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); + + } + + return true; + + }; + + } else if ( ! intersectsRange ) { + + if ( intersectsTriangle ) { + + intersectsRange = ( offset, count, contained, depth ) => { + + return iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle ); + + }; + + } else { + + intersectsRange = ( offset, count, contained ) => { + + return contained; + + }; + + } + + } + + let result = false; + let byteOffset = 0; + for ( const root of this._roots ) { + + setBuffer( root ); + result = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset ); + clearBuffer(); + + if ( result ) { + + break; + + } + + byteOffset += root.byteLength; + + } + + return result; + + } + + /* Derived Cast Functions */ + intersectsBox( mesh, box, boxToMesh ) { + + obb.set( box.min, box.max, boxToMesh ); + obb.update(); + + return this.shapecast( + mesh, + { + intersectsBounds: box => obb.intersectsBox( box ), + intersectsTriangle: tri => obb.intersectsTriangle( tri ) + } + ); + + } + + intersectsSphere( mesh, sphere ) { + + return this.shapecast( + mesh, + { + intersectsBounds: box => sphere.intersectsBox( box ), + intersectsTriangle: tri => tri.intersectsSphere( sphere ) + } + ); + + } + + closestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) { + + if ( ! otherGeometry.boundingBox ) { + + otherGeometry.computeBoundingBox(); + + } + + obb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh ); + obb.update(); + + const pos = otherGeometry.attributes.position; + const index = otherGeometry.index; + + let tempTarget1 = null; + let tempTarget2 = null; + if ( target1 ) { + + tempTarget1 = temp1; + + } + + if ( target2 ) { + + tempTarget2 = temp2; + + } + + let closestDistance = Infinity; + this.shapecast( + mesh, + { + + boundsTraverseOrder: box => { + + return obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) ); + + }, + + intersectsBounds: ( box, isLeaf, score ) => { + + return score < closestDistance && score < maxThreshold; + + }, + + intersectsTriangle: tri => { + + if ( tri.needsUpdate ) { + + tri.update(); + + } + + const sphere1 = tri.sphere; + for ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) { + + setTriangle( tri2, i2, index, pos ); + tri2.a.applyMatrix4( geometryToBvh ); + tri2.b.applyMatrix4( geometryToBvh ); + tri2.c.applyMatrix4( geometryToBvh ); + tri2.sphere.setFromPoints( tri2.points ); + + const sphere2 = tri2.sphere; + const sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius; + if ( sphereDist > closestDistance ) { + + continue; + + } + + tri2.update(); + + const dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 ); + if ( dist < closestDistance ) { + + if ( target1 ) { + + target1.copy( tempTarget1 ); + + } + + if ( target2 ) { + + target2.copy( tempTarget2 ); + + } + + closestDistance = dist; + + } + + // stop traversal if we find a point that's under the given threshold + if ( dist < minThreshold ) { + + return true; + + } + + } + + return false; + + } + + } + + ); + + return closestDistance; + + } + + distanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) { + + return this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold ); + + } + + closestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) { + + // early out if under minThreshold + // skip checking if over maxThreshold + // set minThreshold = maxThreshold to quickly check if a point is within a threshold + // returns Infinity if no value found + const minThresholdSq = minThreshold * minThreshold; + const maxThresholdSq = maxThreshold * maxThreshold; + let closestDistanceSq = Infinity; + this.shapecast( + + mesh, + { + + boundsTraverseOrder: box => { + + temp.copy( point ).clamp( box.min, box.max ); + return temp.distanceToSquared( point ); + + }, + + intersectsBounds: ( box, isLeaf, score ) => { + + return score < closestDistanceSq && score < maxThresholdSq; + + }, + + intersectsTriangle: tri => { + + tri.closestPointToPoint( point, temp ); + const distSq = point.distanceToSquared( temp ); + if ( distSq < closestDistanceSq ) { + + if ( target ) { + + target.copy( temp ); + + } + + closestDistanceSq = distSq; + + } + + if ( distSq < minThresholdSq ) { + + return true; + + } else { + + return false; + + } + + }, + + } + + ); + + return Math.sqrt( closestDistanceSq ); + + } + + distanceToPoint( mesh, point, minThreshold, maxThreshold ) { + + return this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold ); + + } + + getBoundingBox( target ) { + + target.makeEmpty(); + + const roots = this._roots; + roots.forEach( buffer => { + + arrayToBox$1( 0, new Float32Array( buffer ), tempBox ); + target.union( tempBox ); + + } ); + + return target; + + } + + } + + const wiremat = new three.LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } ); + const boxGeom = new three.Box3Helper().geometry; + let boundingBox$1 = new three.Box3(); + + class MeshBVHRootVisualizer extends three.Group { + + constructor( mesh, depth = 10, group = 0 ) { + + super( 'MeshBVHRootVisualizer' ); + + this.depth = depth; + this.mesh = mesh; + this._group = group; + + this.update(); + + } + + update() { + + const boundsTree = this.mesh.geometry.boundsTree; + let requiredChildren = 0; + if ( boundsTree ) { + + boundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => { + + let isTerminal = isLeaf || countOrIsUnfinished; + + // Stop traversal + if ( depth >= this.depth ) { + + return true; + + } + + if ( depth === this.depth - 1 || isTerminal ) { + + let m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null; + if ( ! m ) { + + m = new three.LineSegments( boxGeom, wiremat ); + m.raycast = () => []; + this.add( m ); + + } + + requiredChildren ++; + arrayToBox( boundingData, boundingBox$1 ); + boundingBox$1.getCenter( m.position ); + m.scale.subVectors( boundingBox$1.max, boundingBox$1.min ).multiplyScalar( 0.5 ); + + if ( m.scale.x === 0 ) m.scale.x = Number.EPSILON; + if ( m.scale.y === 0 ) m.scale.y = Number.EPSILON; + if ( m.scale.z === 0 ) m.scale.z = Number.EPSILON; + + } + + } ); + + } + + while ( this.children.length > requiredChildren ) this.remove( this.children.pop() ); + + } + + } + + class MeshBVHVisualizer extends three.Group { + + constructor( mesh, depth = 10 ) { + + super( 'MeshBVHVisualizer' ); + + this.depth = depth; + this.mesh = mesh; + this._roots = []; + + this.update(); + + } + + update() { + + const bvh = this.mesh.geometry.boundsTree; + const totalRoots = bvh ? bvh._roots.length : 0; + while ( this._roots.length > totalRoots ) { + + this._roots.pop(); + + } + + for ( let i = 0; i < totalRoots; i ++ ) { + + if ( i >= this._roots.length ) { + + const root = new MeshBVHRootVisualizer( this.mesh, this.depth, i ); + this.add( root ); + this._roots.push( root ); + + } else { + + let root = this._roots[ i ]; + root.depth = this.depth; + root.mesh = this.mesh; + root.update(); + + } + + } + + } + + updateMatrixWorld( ...args ) { + + this.position.copy( this.mesh.position ); + this.rotation.copy( this.mesh.rotation ); + this.scale.copy( this.mesh.scale ); + + super.updateMatrixWorld( ...args ); + + } + + copy( source ) { + + this.depth = source.depth; + this.mesh = source.mesh; + + } + + clone() { + + return new MeshBVHVisualizer( this.mesh, this.depth ); + + } + + } + + // https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object + function getPrimitiveSize( el ) { + + switch ( typeof el ) { + + case 'number': + return 8; + case 'string': + return el.length * 2; + case 'boolean': + return 4; + default: + return 0; + + } + + } + + function isTypedArray( arr ) { + + const regex = /(Uint|Int|Float)(8|16|32)Array/; + return regex.test( arr.constructor.name ); + + } + + function getRootExtremes( bvh, group ) { + + const result = { + total: 0, + depth: { + min: Infinity, max: - Infinity + }, + tris: { + min: Infinity, max: - Infinity + }, + splits: [ 0, 0, 0 ] + }; + + bvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => { + + result.total ++; + if ( isLeaf ) { + + result.depth.min = Math.min( depth, result.depth.min ); + result.depth.max = Math.max( depth, result.depth.max ); + + result.tris.min = Math.min( count, result.tris.min ); + result.tris.max = Math.max( count, result.tris.max ); + + } else { + + result.splits[ offsetOrSplit ] ++; + + } + + }, group ); + + // If there are no leaf nodes because the tree hasn't finished generating yet. + if ( result.tris.min === Infinity ) { + + result.tris.min = 0; + result.tris.max = 0; + + } + + if ( result.depth.min === Infinity ) { + + result.depth.min = 0; + result.depth.max = 0; + + } + + return result; + + } + + function getBVHExtremes( bvh ) { + + return bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) ); + + } + + function estimateMemoryInBytes( obj ) { + + const traversed = new Set(); + const stack = [ obj ]; + let bytes = 0; + + while ( stack.length ) { + + const curr = stack.pop(); + if ( traversed.has( curr ) ) { + + continue; + + } + traversed.add( curr ); + + for ( let key in curr ) { + + if ( ! curr.hasOwnProperty( key ) ) { + + continue; + + } + + bytes += getPrimitiveSize( key ); + + const value = curr[ key ]; + if ( value && ( typeof value === 'object' || typeof value === 'function' ) ) { + + if ( isTypedArray( value ) ) { + + bytes += value.byteLength; + + } else if ( value instanceof ArrayBuffer ) { + + bytes += value.byteLength; + + } else { + + stack.push( value ); + + } + + } else { + + bytes += getPrimitiveSize( value ); + + } + + + } + + } + + return bytes; + + } + + const box1 = new three.Box3(); + const box2 = new three.Box3(); + const vec = new three.Vector3(); + + class MeshBVHDebug { + + constructor( bvh, geometry ) { + + this.bvh = bvh; + this.geometry = geometry; + + } + + // Returns a simple, human readable object that represents the BVH. + getJSONStructure() { + + const { bvh } = this; + const depthStack = []; + + bvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => { + + const info = { + bounds: arrayToBox( boundingData, new three.Box3() ), + }; + + if ( isLeaf ) { + + info.count = count; + info.offset = offset; + + } else { + + info.left = null; + info.right = null; + + } + + depthStack[ depth ] = info; + + // traversal hits the left then right node + const parent = depthStack[ depth - 1 ]; + if ( parent ) { + + if ( parent.left === null ) { + + parent.left = info; + + } else { + + parent.right = info; + + } + + } + + } ); + + return depthStack[ 0 ]; + + } + + validateBounds() { + + const { bvh, geometry } = this; + const depthStack = []; + const index = geometry.index; + const position = geometry.getAttribute( 'position' ); + let passes = true; + + bvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => { + + const info = { + depth, + isLeaf, + boundingData, + offset, + count, + }; + depthStack[ depth ] = info; + + arrayToBox( boundingData, box1 ); + const parent = depthStack[ depth - 1 ]; + + if ( isLeaf ) { + + // check triangles + for ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) { + + const i0 = index.getX( i ); + const i1 = index.getX( i + 1 ); + const i2 = index.getX( i + 2 ); + + let isContained; + + vec.fromBufferAttribute( position, i0 ); + isContained = box1.containsPoint( vec ); + + vec.fromBufferAttribute( position, i1 ); + isContained = isContained && box1.containsPoint( vec ); + + vec.fromBufferAttribute( position, i2 ); + isContained = isContained && box1.containsPoint( vec ); + + console.assert( isContained, 'Leaf bounds does not fully contain triangle.' ); + passes = passes && isContained; + + } + + } + + if ( parent ) { + + // check if my bounds fit in my parents + arrayToBox( boundingData, box2 ); + + const isContained = box2.containsBox( box1 ); + console.assert( isContained, 'Parent bounds does not fully contain child.' ); + passes = passes && isContained; + + } + + } ); + + return passes; + + } + + } + + const ray = new three.Ray(); + const tmpInverseMatrix = new three.Matrix4(); + const origMeshRaycastFunc = three.Mesh.prototype.raycast; + + function acceleratedRaycast( raycaster, intersects ) { + + if ( this.geometry.boundsTree ) { + + if ( this.material === undefined ) return; + + tmpInverseMatrix.copy( this.matrixWorld ).invert(); + ray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix ); + + if ( raycaster.firstHitOnly === true ) { + + const res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray ); + if ( res ) intersects.push( res ); + + } else { + + this.geometry.boundsTree.raycast( this, raycaster, ray, intersects ); + + } + + } else { + + origMeshRaycastFunc.call( this, raycaster, intersects ); + + } + + } + + function computeBoundsTree( options ) { + + this.boundsTree = new MeshBVH( this, options ); + return this.boundsTree; + + } + + function disposeBoundsTree() { + + this.boundsTree = null; + + } + + exports.MeshBVH = MeshBVH; + exports.Visualizer = MeshBVHVisualizer; + exports.MeshBVHVisualizer = MeshBVHVisualizer; + exports.MeshBVHDebug = MeshBVHDebug; + exports.acceleratedRaycast = acceleratedRaycast; + exports.computeBoundsTree = computeBoundsTree; + exports.disposeBoundsTree = disposeBoundsTree; + exports.CENTER = CENTER; + exports.AVERAGE = AVERAGE; + exports.SAH = SAH; + exports.NOT_INTERSECTED = NOT_INTERSECTED; + exports.INTERSECTED = INTERSECTED; + exports.CONTAINED = CONTAINED; + exports.estimateMemoryInBytes = estimateMemoryInBytes; + exports.getBVHExtremes = getBVHExtremes; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=index.umd.js.map diff --git a/build/index.umd.js.map b/build/index.umd.js.map index bf47ee628..4164a6caf 100644 --- a/build/index.umd.js.map +++ b/build/index.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"index.umd.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\r\nexport const closestPointLineToLine = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\r\n\tconst dir1 = new Vector3();\r\n\tconst dir2 = new Vector3();\r\n\tconst v02 = new Vector3();\r\n\treturn function closestPointLineToLine( l1, l2, result ) {\r\n\r\n\t\tconst v0 = l1.start;\r\n\t\tconst v10 = dir1;\r\n\t\tconst v2 = l2.start;\r\n\t\tconst v32 = dir2;\r\n\r\n\t\tv02.subVectors( v0, v2 );\r\n\t\tdir1.subVectors( l1.end, l2.start );\r\n\t\tdir2.subVectors( l2.end, l2.start );\r\n\r\n\t\t// float d0232 = v02.Dot(v32);\r\n\t\tconst d0232 = v02.dot( v32 );\r\n\r\n\t\t// float d3210 = v32.Dot(v10);\r\n\t\tconst d3210 = v32.dot( v10 );\r\n\r\n\t\t// float d3232 = v32.Dot(v32);\r\n\t\tconst d3232 = v32.dot( v32 );\r\n\r\n\t\t// float d0210 = v02.Dot(v10);\r\n\t\tconst d0210 = v02.dot( v10 );\r\n\r\n\t\t// float d1010 = v10.Dot(v10);\r\n\t\tconst d1010 = v10.dot( v10 );\r\n\r\n\t\t// float denom = d1010*d3232 - d3210*d3210;\r\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\r\n\r\n\t\tlet d, d2;\r\n\t\tif ( denom !== 0 ) {\r\n\r\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\r\n\r\n\t\t} else {\r\n\r\n\t\t\td = 0;\r\n\r\n\t\t}\r\n\r\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\r\n\r\n\t\tresult.x = d;\r\n\t\tresult.y = d2;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const closestPointsSegmentToSegment = ( function () {\r\n\r\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\r\n\tconst paramResult = new Vector2();\r\n\tconst temp1 = new Vector3();\r\n\tconst temp2 = new Vector3();\r\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\r\n\r\n\t\tclosestPointLineToLine( l1, l2, paramResult );\r\n\r\n\t\tlet d = paramResult.x;\r\n\t\tlet d2 = paramResult.y;\r\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\tl1.at( d, target1 );\r\n\t\t\tl2.at( d2, target2 );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d >= 0 && d <= 1 ) {\r\n\r\n\t\t\t// Only d2 is out of bounds.\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tl2.at( 0, target2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl2.at( 1, target2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\r\n\t\t\treturn;\r\n\r\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\r\n\r\n\t\t\t// Only d is out of bounds.\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tl1.at( 0, target1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tl1.at( 1, target1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Both u and u2 are out of bounds.\r\n\t\t\tlet p;\r\n\t\t\tif ( d < 0 ) {\r\n\r\n\t\t\t\tp = l1.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp = l1.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet p2;\r\n\t\t\tif ( d2 < 0 ) {\r\n\r\n\t\t\t\tp2 = l2.start;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp2 = l2.end;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst closestPoint = temp1;\r\n\t\t\tconst closestPoint2 = temp2;\r\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\r\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\r\n\r\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\r\n\r\n\t\t\t\ttarget1.copy( closestPoint );\r\n\t\t\t\ttarget2.copy( p2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttarget1.copy( p );\r\n\t\t\t\ttarget2.copy( closestPoint2 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nexport const sphereIntersectTriangle = ( function () {\r\n\r\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\r\n\tconst closestPointTemp = new Vector3();\r\n\tconst projectedPointTemp = new Vector3();\r\n\tconst planeTemp = new Plane();\r\n\tconst lineTemp = new Line3();\r\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\r\n\r\n\t\tconst { radius, center } = sphere;\r\n\t\tconst { a, b, c } = triangle;\r\n\r\n\t\t// phase 1\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = b;\r\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = a;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\tlineTemp.start = b;\r\n\t\tlineTemp.end = c;\r\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\r\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\r\n\r\n\t\t// phase 2\r\n\t\tconst plane = triangle.getPlane( planeTemp );\r\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\r\n\t\tif ( dp <= radius ) {\r\n\r\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\r\n\t\t\tconst cp = triangle.containsPoint( pp );\r\n\t\t\tif ( cp ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\r\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\r\n\r\nexport class OrientedBox extends Box3 {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isOrientedBox = true;\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.invMatrix = new Matrix4();\r\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\r\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.sphere = new Sphere();\r\n\r\n\t}\r\n\r\n\tset( min, max, matrix ) {\r\n\r\n\t\tsuper.set( min, max );\r\n\t\tthis.matrix = matrix;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tsuper.copy( other );\r\n\t\tthis.matrix.copy( other.matrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nOrientedBox.prototype.update = ( function () {\r\n\r\n\treturn function update() {\r\n\r\n\t\tconst matrix = this.matrix;\r\n\t\tconst min = this.min;\r\n\t\tconst max = this.max;\r\n\r\n\t\tconst points = this.points;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\r\n\t\t\t\t\tconst v = points[ i ];\r\n\t\t\t\t\tv.x = x ? max.x : min.x;\r\n\t\t\t\t\tv.y = y ? max.y : min.y;\r\n\t\t\t\t\tv.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tv.applyMatrix4( matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst minVec = points[ 0 ];\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst index = 1 << i;\r\n\t\t\tconst pi = points[ index ];\r\n\r\n\t\t\taxis.subVectors( minVec, pi );\r\n\t\t\tsb.setFromPoints( axis, points );\r\n\r\n\t\t}\r\n\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\r\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\r\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\r\n\r\n\t\tthis.invMatrix.copy( this.matrix ).invert();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsBox = ( function () {\r\n\r\n\tconst aabbBounds = new SeparatingAxisBounds();\r\n\treturn function intersectsBox( box ) {\r\n\r\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\r\n\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst alignedSatBounds = this.alignedSatBounds;\r\n\r\n\t\taabbBounds.min = min.x;\r\n\t\taabbBounds.max = max.x;\r\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.y;\r\n\t\taabbBounds.max = max.y;\r\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\taabbBounds.min = min.z;\r\n\t\taabbBounds.max = max.z;\r\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst axis = satAxes[ i ];\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\taabbBounds.setFromBox( axis, box );\r\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri = new SeparatingAxisTriangle();\r\n\tconst pointsArr = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( triangle ) {\r\n\r\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri.copy( triangle );\r\n\t\t\tsaTri.update();\r\n\t\t\ttriangle = saTri;\r\n\r\n\t\t} else if ( triangle.needsUpdate ) {\r\n\r\n\t\t\ttriangle.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds = this.satBounds;\r\n\t\tconst satAxes = this.satAxes;\r\n\r\n\t\tpointsArr[ 0 ] = triangle.a;\r\n\t\tpointsArr[ 1 ] = triangle.b;\r\n\t\tpointsArr[ 2 ] = triangle.c;\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds[ i ];\r\n\t\t\tconst sa = satAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst triSatBounds = triangle.satBounds;\r\n\t\tconst triSatAxes = triangle.satAxes;\r\n\t\tconst points = this.points;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = triSatBounds[ i ];\r\n\t\t\tconst sa = triSatAxes[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.closestPointToPoint = ( function () {\r\n\r\n\treturn function closestPointToPoint( point, target1 ) {\r\n\r\n\t\ttarget1\r\n\t\t\t.copy( point )\r\n\t\t\t.applyMatrix4( this.invMatrix )\r\n\t\t\t.clamp( this.min, this.max )\r\n\t\t\t.applyMatrix4( this.matrix );\r\n\r\n\t\treturn target1;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nOrientedBox.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nOrientedBox.prototype.distanceToBox = ( function () {\r\n\r\n\tconst xyzFields = [ 'x', 'y', 'z' ];\r\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\r\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\r\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.intersectsBox( box ) ) {\r\n\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tbox.getCenter( point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tconst threshold2 = threshold * threshold;\r\n\t\tconst min = box.min;\r\n\t\tconst max = box.max;\r\n\t\tconst points = this.points;\r\n\r\n\r\n\t\t// iterate over every edge and compare distances\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check over all these points\r\n\t\tfor ( let i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tpoint2.copy( p ).clamp( min, max );\r\n\r\n\t\t\tconst dist = p.distanceToSquared( point2 );\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( p );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate and check all line segment distances\r\n\t\tlet count = 0;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\r\n\r\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\r\n\r\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\r\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\r\n\r\n\t\t\t\t\t// get obb line segments\r\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\r\n\t\t\t\t\tconst p1 = points[ index ];\r\n\t\t\t\t\tconst p2 = points[ index2 ];\r\n\t\t\t\t\tconst line1 = segments1[ count ];\r\n\t\t\t\t\tline1.set( p1, p2 );\r\n\r\n\r\n\t\t\t\t\t// get aabb line segments\r\n\t\t\t\t\tconst f1 = xyzFields[ i ];\r\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\r\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\r\n\t\t\t\t\tconst line2 = segments2[ count ];\r\n\t\t\t\t\tconst start = line2.start;\r\n\t\t\t\t\tconst end = line2.end;\r\n\r\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\r\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\r\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\r\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\r\n\r\n\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check all the other boxes point\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\r\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\r\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\r\n\r\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\r\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\r\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 12; i ++ ) {\r\n\r\n\t\t\tconst l1 = segments1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\r\n\r\n\t\t\t\tconst l2 = segments2[ i2 ];\r\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\r\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\t\t\t_traverse( 0 );\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( left );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( left ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( right );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( right ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs and CHANGELOG for full signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper","boundingBox","Group","LineSegments","Ray"],"mappings":";;;;;;CAAA;AACA,AAAY,OAAC,MAAM,GAAG,CAAC,CAAC;AACxB,AAAY,OAAC,OAAO,GAAG,CAAC,CAAC;AACzB,AAAY,OAAC,GAAG,GAAG,CAAC,CAAC;;AAErB,AAAY,OAAC,eAAe,GAAG,CAAC,CAAC;AACjC,AAAY,OAAC,WAAW,GAAG,CAAC,C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,CAAC;CAC7E,GAAG,KAAK,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;;CAErC,GAAG,MAAM;;CAET,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;;CAExE,GAAG;;CAEH,EAAE,MAAM;;CAER,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;CAE1D,EAAE;;CAEF,CAAC;;CAED,SAAS,iBAAiB,EAAE,OAAO,GAAG;;CAEtC,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.umd.js","sources":["../src/Constants.js","../src/MeshBVHNode.js","../src/Utils/ArrayBoxUtilities.js","../src/buildFunctions.js","../src/Utils/SeparatingAxisBounds.js","../src/Utils/MathUtilities.js","../src/Utils/SeparatingAxisTriangle.js","../src/Utils/OrientedBox.js","../src/Utils/TriangleUtils.js","../src/Utils/ThreeIntersectionUtilities.js","../src/Utils/RayIntersectTriUtlities.js","../src/Utils/BufferNodeUtils.js","../src/castFunctions.js","../src/MeshBVH.js","../src/MeshBVHVisualizer.js","../src/Utils/Debug.js","../src/MeshBVHDebug.js","../src/index.js"],"sourcesContent":["// Split strategy constants\r\nexport const CENTER = 0;\r\nexport const AVERAGE = 1;\r\nexport const SAH = 2;\r\n\r\nexport const NOT_INTERSECTED = 0;\r\nexport const INTERSECTED = 1;\r\nexport const CONTAINED = 2;\r\n","\r\nexport default\r\nclass MeshBVHNode {\r\n\r\n\tconstructor() {\r\n\r\n\t\t// internal nodes have boundingData, left, right, and splitAxis\r\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\r\n\r\n\t}\r\n\r\n}\r\n","// Returns a Float32Array representing the bounds data for box.\r\nexport function boxToArray( bx ) {\r\n\r\n\tconst arr = new Float32Array( 6 );\r\n\r\n\tarr[ 0 ] = bx.min.x;\r\n\tarr[ 1 ] = bx.min.y;\r\n\tarr[ 2 ] = bx.min.z;\r\n\r\n\tarr[ 3 ] = bx.max.x;\r\n\tarr[ 4 ] = bx.max.y;\r\n\tarr[ 5 ] = bx.max.z;\r\n\r\n\treturn arr;\r\n\r\n}\r\n\r\nexport function arrayToBox( arr, target ) {\r\n\r\n\ttarget.min.x = arr[ 0 ];\r\n\ttarget.min.y = arr[ 1 ];\r\n\ttarget.min.z = arr[ 2 ];\r\n\r\n\ttarget.max.x = arr[ 3 ];\r\n\ttarget.max.y = arr[ 4 ];\r\n\ttarget.max.z = arr[ 5 ];\r\n\r\n\treturn target;\r\n\r\n}\r\n\r\nexport function getLongestEdgeIndex( bounds ) {\r\n\r\n\tlet splitDimIdx = - 1;\r\n\tlet splitDist = - Infinity;\r\n\r\n\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\r\n\t\tif ( dist > splitDist ) {\r\n\r\n\t\t\tsplitDist = dist;\r\n\t\t\tsplitDimIdx = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn splitDimIdx;\r\n\r\n}\r\n","import { Box3, BufferAttribute } from 'three';\r\nimport MeshBVHNode from './MeshBVHNode.js';\r\nimport { arrayToBox, boxToArray, getLongestEdgeIndex } from './Utils/ArrayBoxUtilities.js';\r\nimport { CENTER, AVERAGE, SAH } from './Constants.js';\r\n\r\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\r\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\nconst boxTemp = new Box3();\r\n\r\nfunction ensureIndex( geo ) {\r\n\r\n\tif ( ! geo.index ) {\r\n\r\n\t\tconst vertexCount = geo.attributes.position.count;\r\n\t\tconst index = new ( vertexCount > 65535 ? Uint32Array : Uint16Array )( vertexCount );\r\n\t\tgeo.setIndex( new BufferAttribute( index, 1 ) );\r\n\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tindex[ i ] = i;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\r\n// region in the geometry index that belongs to a different set of material groups requires\r\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\r\n// with triangle indices belongs to another group. For example, if the groups were like this:\r\n//\r\n// [-------------------------------------------------------------]\r\n// |__________________|\r\n// g0 = [0, 20] |______________________||_____________________|\r\n// g1 = [16, 40] g2 = [41, 60]\r\n//\r\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\r\nfunction getRootIndexRanges( geo ) {\r\n\r\n\tif ( ! geo.groups || ! geo.groups.length ) {\r\n\r\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\r\n\r\n\t}\r\n\r\n\tconst ranges = [];\r\n\tconst rangeBoundaries = new Set();\r\n\tfor ( const group of geo.groups ) {\r\n\r\n\t\trangeBoundaries.add( group.start );\r\n\t\trangeBoundaries.add( group.start + group.count );\r\n\r\n\t}\r\n\r\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\r\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\r\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\r\n\r\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\r\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\r\n\r\n\t}\r\n\r\n\treturn ranges;\r\n\r\n}\r\n\r\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\r\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\r\n// These are computed together to avoid redundant accesses to bounds array.\r\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\r\n\r\n\tlet minx = Infinity;\r\n\tlet miny = Infinity;\r\n\tlet minz = Infinity;\r\n\tlet maxx = - Infinity;\r\n\tlet maxy = - Infinity;\r\n\tlet maxz = - Infinity;\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tconst includeCentroid = centroidTarget !== null;\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tconst hx = triangleBounds[ i + 1 ];\r\n\t\tconst lx = cx - hx;\r\n\t\tconst rx = cx + hx;\r\n\t\tif ( lx < minx ) minx = lx;\r\n\t\tif ( rx > maxx ) maxx = rx;\r\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\r\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tconst hy = triangleBounds[ i + 3 ];\r\n\t\tconst ly = cy - hy;\r\n\t\tconst ry = cy + hy;\r\n\t\tif ( ly < miny ) miny = ly;\r\n\t\tif ( ry > maxy ) maxy = ry;\r\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\r\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tconst hz = triangleBounds[ i + 5 ];\r\n\t\tconst lz = cz - hz;\r\n\t\tconst rz = cz + hz;\r\n\t\tif ( lz < minz ) minz = lz;\r\n\t\tif ( rz > maxz ) maxz = rz;\r\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\r\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\ttarget[ 0 ] = minx;\r\n\ttarget[ 1 ] = miny;\r\n\ttarget[ 2 ] = minz;\r\n\r\n\ttarget[ 3 ] = maxx;\r\n\ttarget[ 4 ] = maxy;\r\n\ttarget[ 5 ] = maxz;\r\n\r\n\tif ( includeCentroid ) {\r\n\r\n\t\tcentroidTarget[ 0 ] = cminx;\r\n\t\tcentroidTarget[ 1 ] = cminy;\r\n\t\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\t\tcentroidTarget[ 3 ] = cmaxx;\r\n\t\tcentroidTarget[ 4 ] = cmaxy;\r\n\t\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// A stand alone function for retrieving the centroid bounds.\r\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\r\n\r\n\tlet cminx = Infinity;\r\n\tlet cminy = Infinity;\r\n\tlet cminz = Infinity;\r\n\tlet cmaxx = - Infinity;\r\n\tlet cmaxy = - Infinity;\r\n\tlet cmaxz = - Infinity;\r\n\r\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\r\n\r\n\t\tconst cx = triangleBounds[ i + 0 ];\r\n\t\tif ( cx < cminx ) cminx = cx;\r\n\t\tif ( cx > cmaxx ) cmaxx = cx;\r\n\r\n\t\tconst cy = triangleBounds[ i + 2 ];\r\n\t\tif ( cy < cminy ) cminy = cy;\r\n\t\tif ( cy > cmaxy ) cmaxy = cy;\r\n\r\n\t\tconst cz = triangleBounds[ i + 4 ];\r\n\t\tif ( cz < cminz ) cminz = cz;\r\n\t\tif ( cz > cmaxz ) cmaxz = cz;\r\n\r\n\t}\r\n\r\n\tcentroidTarget[ 0 ] = cminx;\r\n\tcentroidTarget[ 1 ] = cminy;\r\n\tcentroidTarget[ 2 ] = cminz;\r\n\r\n\tcentroidTarget[ 3 ] = cmaxx;\r\n\tcentroidTarget[ 4 ] = cmaxy;\r\n\tcentroidTarget[ 5 ] = cmaxz;\r\n\r\n}\r\n\r\n\r\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\r\n// will be on the left and elements on the right side of the split will be on the right. returns the index\r\n// of the first element on the right side, or offset + count if there are no elements on the right side.\r\nfunction partition( index, triangleBounds, sahPlanes, offset, count, split ) {\r\n\r\n\tlet left = offset;\r\n\tlet right = offset + count - 1;\r\n\tconst pos = split.pos;\r\n\tconst axisOffset = split.axis * 2;\r\n\r\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\r\n\twhile ( true ) {\r\n\r\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\r\n\r\n\t\t\tleft ++;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\r\n\r\n\t\t\tright --;\r\n\r\n\t\t}\r\n\r\n\t\tif ( left < right ) {\r\n\r\n\t\t\t// we need to swap all of the information associated with the triangles at index\r\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\r\n\t\t\t// and perhaps the SAH planes\r\n\r\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\tlet t0 = index[ left * 3 + i ];\r\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\r\n\t\t\t\tindex[ right * 3 + i ] = t0;\r\n\r\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\r\n\r\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\r\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( sahPlanes ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tlet t = sahPlanes[ i ][ left ];\r\n\t\t\t\t\tsahPlanes[ i ][ left ] = sahPlanes[ i ][ right ];\r\n\t\t\t\t\tsahPlanes[ i ][ right ] = t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tleft ++;\r\n\t\t\tright --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn left;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy ) {\r\n\r\n\tlet axis = - 1;\r\n\tlet pos = 0;\r\n\r\n\t// Center\r\n\tif ( strategy === CENTER ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( centroidBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === AVERAGE ) {\r\n\r\n\t\taxis = getLongestEdgeIndex( nodeBoundingData );\r\n\t\tif ( axis !== - 1 ) {\r\n\r\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\r\n\r\n\t\t}\r\n\r\n\t} else if ( strategy === SAH ) {\r\n\r\n\t\t// Surface Area Heuristic\r\n\t\t// In order to make this code more terse, the x, y, and z\r\n\t\t// variables of various structures have been stuffed into\r\n\t\t// 0, 1, and 2 array indices so they can be easily computed\r\n\t\t// and accessed within array iteration\r\n\r\n\t\t// Cost values defineed for operations. We're using bounds for traversal, so\r\n\t\t// the cost of traversing one more layer is more than intersecting a triangle.\r\n\t\tconst TRAVERSAL_COST = 3;\r\n\t\tconst INTERSECTION_COST = 1;\r\n\t\tconst bb = arrayToBox( nodeBoundingData, boxTemp );\r\n\r\n\t\t// Define the width, height, and depth of the bounds as a box\r\n\t\tconst dim = [\r\n\t\t\tbb.max.x - bb.min.x,\r\n\t\t\tbb.max.y - bb.min.y,\r\n\t\t\tbb.max.z - bb.min.z\r\n\t\t];\r\n\t\tconst sa = 2 * ( dim[ 0 ] * dim[ 1 ] + dim[ 0 ] * dim[ 2 ] + dim[ 1 ] * dim[ 2 ] );\r\n\r\n\t\t// Get the precalculated planes based for the triangles we're\r\n\t\t// testing here\r\n\t\tconst filteredLists = [[], [], []];\r\n\t\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\t\tfor ( let v = 0; v < 3; v ++ ) {\r\n\r\n\t\t\t\tfilteredLists[ v ].push( sahPlanes[ v ][ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfilteredLists.forEach( planes => planes.sort( ( a, b ) => a.p - b.p ) );\r\n\r\n\t\t// this bounds surface area, left bound SA, left triangles, right bound SA, right triangles\r\n\t\tconst getCost = ( sa, sal, nl, sar, nr ) =>\r\n\t\t\t TRAVERSAL_COST + INTERSECTION_COST * ( ( sal / sa ) * nl + ( sar / sa ) * nr );\r\n\r\n\t\t// the cost of _not_ splitting into smaller bounds\r\n\t\tconst noSplitCost = INTERSECTION_COST * count;\r\n\r\n\t\taxis = - 1;\r\n\t\tlet bestCost = noSplitCost;\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t// o1 and o2 represent the _other_ two axes in the\r\n\t\t\t// the space. So if we're checking the x (0) dimension,\r\n\t\t\t// then o1 and o2 would be y and z (1 and 2)\r\n\t\t\tconst o1 = ( i + 1 ) % 3;\r\n\t\t\tconst o2 = ( i + 2 ) % 3;\r\n\r\n\t\t\tconst bmin = bb.min[ xyzFields[ i ] ];\r\n\t\t\tconst bmax = bb.max[ xyzFields[ i ] ];\r\n\t\t\tconst planes = filteredLists[ i ];\r\n\r\n\t\t\t// The number of left and right triangles on either side\r\n\t\t\t// given the current split\r\n\t\t\tlet nl = 0;\r\n\t\t\tlet nr = count;\r\n\t\t\tfor ( let p = 0; p < planes.length; p ++ ) {\r\n\r\n\t\t\t\tconst pinfo = planes[ p ];\r\n\r\n\t\t\t\t// As the plane moves, we have to increment or decrement the\r\n\t\t\t\t// number of triangles on either side of the plane\r\n\t\t\t\tnl ++;\r\n\t\t\t\tnr --;\r\n\r\n\t\t\t\t// the distance from the plane to the edge of the broader bounds\r\n\t\t\t\tconst ldim = pinfo.p - bmin;\r\n\t\t\t\tconst rdim = bmax - pinfo.p;\r\n\r\n\t\t\t\t// same for the other two dimensions\r\n\t\t\t\tlet ldimo1 = dim[ o1 ], rdimo1 = dim[ o1 ];\r\n\t\t\t\tlet ldimo2 = dim[ o2 ], rdimo2 = dim[ o2 ];\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t// compute the other bounding planes for the box\r\n\t\t\t\t// if only the current triangles are considered to\r\n\t\t\t\t// be in the box\r\n\t\t\t\t// This is really slow and probably not really worth it\r\n\t\t\t\tconst o1planes = sahPlanes[o1];\r\n\t\t\t\tconst o2planes = sahPlanes[o2];\r\n\t\t\t\tlet lmin = Infinity, lmax = -Infinity;\r\n\t\t\t\tlet rmin = Infinity, rmax = -Infinity;\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o1planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o1planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo1 = Math.min(lmax - lmin, ldimo1);\r\n\t\t\t\trdimo1 = Math.min(rmax - rmin, rdimo1);\r\n\r\n\t\t\t\tplanes.forEach((p, i) => {\r\n\t\t\t\tconst tri2 = p.tri * 2;\r\n\t\t\t\tconst inf1 = o2planes[tri2 + 0];\r\n\t\t\t\tconst inf2 = o2planes[tri2 + 1];\r\n\t\t\t\tif (i <= nl) {\r\n\t\t\t\tlmin = Math.min(inf1.p, inf2.p, lmin);\r\n\t\t\t\tlmax = Math.max(inf1.p, inf2.p, lmax);\r\n\t\t\t\t}\r\n\t\t\t\tif (i >= nr) {\r\n\t\t\t\trmin = Math.min(inf1.p, inf2.p, rmin);\r\n\t\t\t\trmax = Math.max(inf1.p, inf2.p, rmax);\r\n\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tldimo2 = Math.min(lmax - lmin, ldimo2);\r\n\t\t\t\trdimo2 = Math.min(rmax - rmin, rdimo2);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// surface areas and cost\r\n\t\t\t\tconst sal = 2 * ( ldimo1 * ldimo2 + ldimo1 * ldim + ldimo2 * ldim );\r\n\t\t\t\tconst sar = 2 * ( rdimo1 * rdimo2 + rdimo1 * rdim + rdimo2 * rdim );\r\n\t\t\t\tconst cost = getCost( sa, sal, nl, sar, nr );\r\n\r\n\t\t\t\tif ( cost < bestCost ) {\r\n\r\n\t\t\t\t\taxis = i;\r\n\t\t\t\t\tpos = pinfo.p;\r\n\t\t\t\t\tbestCost = cost;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { axis, pos };\r\n\r\n}\r\n\r\n// returns the average coordinate on the specified axis of the all the provided triangles\r\nfunction getAverage( triangleBounds, offset, count, axis ) {\r\n\r\n\tlet avg = 0;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\r\n\r\n\t}\r\n\r\n\treturn avg / count;\r\n\r\n}\r\n\r\nfunction computeSAHPlanes( triangleBounds ) {\r\n\r\n\tconst triCount = triangleBounds.length / 6;\r\n\tconst sahPlanes = [ new Array( triCount ), new Array( triCount ), new Array( triCount ) ];\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tsahPlanes[ el ][ tri ] = { p: triangleBounds[ tri * 6 + el * 2 ], tri };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn sahPlanes;\r\n\r\n}\r\n\r\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\r\n// result is an array of size tris.length * 6 where triangle i maps to a\r\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\r\n// representing the center and half-extent in each dimension of triangle i\r\nfunction computeTriangleBounds( geo ) {\r\n\r\n\tconst verts = geo.attributes.position.array;\r\n\tconst index = geo.index.array;\r\n\tconst triCount = index.length / 3;\r\n\tconst triangleBounds = new Float32Array( triCount * 6 );\r\n\r\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\r\n\r\n\t\tconst tri3 = tri * 3;\r\n\t\tconst tri6 = tri * 6;\r\n\t\tconst ai = index[ tri3 + 0 ] * 3;\r\n\t\tconst bi = index[ tri3 + 1 ] * 3;\r\n\t\tconst ci = index[ tri3 + 2 ] * 3;\r\n\r\n\t\tfor ( let el = 0; el < 3; el ++ ) {\r\n\r\n\t\t\tconst a = verts[ ai + el ];\r\n\t\t\tconst b = verts[ bi + el ];\r\n\t\t\tconst c = verts[ ci + el ];\r\n\r\n\t\t\tlet min = a;\r\n\t\t\tif ( b < min ) min = b;\r\n\t\t\tif ( c < min ) min = c;\r\n\r\n\t\t\tlet max = a;\r\n\t\t\tif ( b > max ) max = b;\r\n\t\t\tif ( c > max ) max = c;\r\n\r\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\r\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\r\n\t\t\t// worked with.\r\n\t\t\tconst halfExtents = ( max - min ) / 2;\r\n\t\t\tconst el2 = el * 2;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\r\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * FLOAT32_EPSILON;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn triangleBounds;\r\n\r\n}\r\n\r\nexport function buildTree( geo, options ) {\r\n\r\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\r\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\r\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\r\n\r\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\r\n\r\n\t\t\treachedMaxDepth = true;\r\n\t\t\tif ( verbose ) {\r\n\r\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\r\n\t\t\t\tconsole.warn( this, geo );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// early out if we've met our capacity\r\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\t// Find where to split the volume\r\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, sahPlanes, offset, count, strategy );\r\n\t\tif ( split.axis === - 1 ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\t\t\treturn node;\r\n\r\n\t\t}\r\n\r\n\t\tconst splitOffset = partition( indexArray, triangleBounds, sahPlanes, offset, count, split );\r\n\r\n\t\t// create the two new child nodes\r\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\r\n\r\n\t\t\tnode.offset = offset;\r\n\t\t\tnode.count = count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnode.splitAxis = split.axis;\r\n\r\n\t\t\t// create the left child and compute its bounding box\r\n\t\t\tconst left = new MeshBVHNode();\r\n\t\t\tconst lstart = offset;\r\n\t\t\tconst lcount = splitOffset - offset;\r\n\t\t\tnode.left = left;\r\n\t\t\tleft.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t\t// repeat for right\r\n\t\t\tconst right = new MeshBVHNode();\r\n\t\t\tconst rstart = splitOffset;\r\n\t\t\tconst rcount = count - lcount;\r\n\t\t\tnode.right = right;\r\n\t\t\tright.boundingData = new Float32Array( 6 );\r\n\r\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\r\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\r\n\t}\r\n\r\n\tensureIndex( geo );\r\n\r\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\r\n\tconst triangleBounds = computeTriangleBounds( geo );\r\n\tconst sahPlanes = options.strategy === SAH ? computeSAHPlanes( triangleBounds ) : null;\r\n\tconst indexArray = geo.index.array;\r\n\tconst maxDepth = options.maxDepth;\r\n\tconst verbose = options.verbose;\r\n\tconst maxLeafTris = options.maxLeafTris;\r\n\tconst strategy = options.strategy;\r\n\tlet reachedMaxDepth = false;\r\n\r\n\tconst roots = [];\r\n\tconst ranges = getRootIndexRanges( geo );\r\n\r\n\tif ( ranges.length === 1 ) {\r\n\r\n\t\tconst root = new MeshBVHNode();\r\n\t\tconst range = ranges[ 0 ];\r\n\r\n\t\tif ( geo.boundingBox != null ) {\r\n\r\n\t\t\troot.boundingData = boxToArray( geo.boundingBox );\r\n\t\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\r\n\r\n\t\t} else {\r\n\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t}\r\n\r\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\troots.push( root );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( let range of ranges ) {\r\n\r\n\t\t\tconst root = new MeshBVHNode();\r\n\t\t\troot.boundingData = new Float32Array( 6 );\r\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\r\n\r\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\r\n\t\t\troots.push( root );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn roots;\r\n\r\n}\r\n\r\nexport const BYTES_PER_NODE = 6 * 4 + 4 + 4;\r\n\r\nexport const IS_LEAFNODE_FLAG = 0xFFFF;\r\n\r\nexport function buildPackedTree( geo, options ) {\r\n\r\n\t// boundingData \t\t\t\t: 6 float32\r\n\t// right / offset \t\t\t\t: 1 uint32\r\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\r\n\tconst roots = buildTree( geo, options );\r\n\r\n\tlet float32Array;\r\n\tlet uint32Array;\r\n\tlet uint16Array;\r\n\tconst packedRoots = [];\r\n\tfor ( let i = 0; i < roots.length; i ++ ) {\r\n\r\n\t\tconst root = roots[ i ];\r\n\t\tlet nodeCount = countNodes( root );\r\n\r\n\t\tconst buffer = new ArrayBuffer( BYTES_PER_NODE * nodeCount );\r\n\t\tfloat32Array = new Float32Array( buffer );\r\n\t\tuint32Array = new Uint32Array( buffer );\r\n\t\tuint16Array = new Uint16Array( buffer );\r\n\t\tpopulateBuffer( 0, root );\r\n\t\tpackedRoots.push( buffer );\r\n\r\n\t}\r\n\r\n\treturn packedRoots;\r\n\r\n\tfunction countNodes( node ) {\r\n\r\n\t\tif ( node.count ) {\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction populateBuffer( byteOffset, node ) {\r\n\r\n\t\tconst stride4Offset = byteOffset / 4;\r\n\t\tconst stride2Offset = byteOffset / 2;\r\n\t\tconst isLeaf = ! ! node.count;\r\n\t\tconst boundingData = node.boundingData;\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = node.offset;\r\n\t\t\tconst count = node.count;\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\r\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\r\n\t\t\tuint16Array[ stride2Offset + 15 ] = IS_LEAFNODE_FLAG;\r\n\t\t\treturn byteOffset + BYTES_PER_NODE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = node.left;\r\n\t\t\tconst right = node.right;\r\n\t\t\tconst splitAxis = node.splitAxis;\r\n\r\n\t\t\tlet nextUnusedPointer;\r\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + BYTES_PER_NODE, left );\r\n\r\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\r\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\r\n\r\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\r\n\t\t\treturn nextUnusedPointer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3 } from 'three';\r\n\r\nexport class SeparatingAxisBounds {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.min = Infinity;\r\n\t\tthis.max = - Infinity;\r\n\r\n\t}\r\n\r\n\tsetFromPointsField( points, field ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = p[ field ];\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\r\n\t}\r\n\r\n\tsetFromPoints( axis, points ) {\r\n\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst p = points[ i ];\r\n\t\t\tconst val = axis.dot( p );\r\n\t\t\tmin = Math.min( val, min );\r\n\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tisSeparated( other ) {\r\n\r\n\t\treturn this.min > other.max || other.min > this.max;\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\r\n\r\n\tconst p = new Vector3();\r\n\treturn function setFromBox( axis, box ) {\r\n\r\n\t\tconst boxMin = box.min;\r\n\t\tconst boxMax = box.max;\r\n\t\tlet min = Infinity;\r\n\t\tlet max = - Infinity;\r\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\r\n\r\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\r\n\r\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\r\n\r\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\r\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\r\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\r\n\r\n\t\t\t\t\tconst val = axis.dot( p );\r\n\t\t\t\t\tmin = Math.min( val, min );\r\n\t\t\t\t\tmax = Math.max( val, max );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const areIntersecting = ( function () {\r\n\r\n\tconst cacheSatBounds = new SeparatingAxisBounds();\r\n\treturn function areIntersecting( shape1, shape2 ) {\r\n\r\n\t\tconst points1 = shape1.points;\r\n\t\tconst satAxes1 = shape1.satAxes;\r\n\t\tconst satBounds1 = shape1.satBounds;\r\n\r\n\t\tconst points2 = shape2.points;\r\n\t\tconst satAxes2 = shape2.satAxes;\r\n\t\tconst satBounds2 = shape2.satBounds;\r\n\r\n\t\t// check axes of the first shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check axes of the second shape\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\r\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n","import { Vector3, Vector2, Plane, Line3 } from 'three';\nexport const closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new Vector3();\n\tconst dir2 = new Vector3();\n\tconst v02 = new Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l2.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nexport const closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new Vector2();\n\tconst temp1 = new Vector3();\n\tconst temp2 = new Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nexport const sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new Vector3();\n\tconst projectedPointTemp = new Vector3();\n\tconst planeTemp = new Plane();\n\tconst lineTemp = new Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n","import { Triangle, Vector3, Line3, Sphere } from 'three';\r\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\r\nimport { closestPointsSegmentToSegment, sphereIntersectTriangle } from './MathUtilities.js';\r\n\r\nexport class SeparatingAxisTriangle extends Triangle {\r\n\r\n\tconstructor( ...args ) {\r\n\r\n\t\tsuper( ...args );\r\n\r\n\t\tthis.isSeparatingAxisTriangle = true;\r\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new Vector3() );\r\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new SeparatingAxisBounds() );\r\n\t\tthis.points = [ this.a, this.b, this.c ];\r\n\t\tthis.sphere = new Sphere();\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphereIntersectTriangle( sphere, this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nSeparatingAxisTriangle.prototype.update = ( function () {\r\n\r\n\tconst arr = new Array( 3 );\r\n\treturn function update() {\r\n\r\n\t\tconst a = this.a;\r\n\t\tconst b = this.b;\r\n\t\tconst c = this.c;\r\n\r\n\t\tarr[ 0 ] = this.a;\r\n\t\tarr[ 1 ] = this.b;\r\n\t\tarr[ 2 ] = this.c;\r\n\r\n\t\tconst satAxes = this.satAxes;\r\n\t\tconst satBounds = this.satBounds;\r\n\r\n\t\tconst axis0 = satAxes[ 0 ];\r\n\t\tconst sab0 = satBounds[ 0 ];\r\n\t\tthis.getNormal( axis0 );\r\n\t\tsab0.setFromPoints( axis0, arr );\r\n\r\n\t\tconst axis1 = satAxes[ 1 ];\r\n\t\tconst sab1 = satBounds[ 1 ];\r\n\t\taxis1.subVectors( a, b );\r\n\t\tsab1.setFromPoints( axis1, arr );\r\n\r\n\t\tconst axis2 = satAxes[ 2 ];\r\n\t\tconst sab2 = satBounds[ 2 ];\r\n\t\taxis2.subVectors( b, c );\r\n\t\tsab2.setFromPoints( axis2, arr );\r\n\r\n\t\tconst axis3 = satAxes[ 3 ];\r\n\t\tconst sab3 = satBounds[ 3 ];\r\n\t\taxis3.subVectors( c, a );\r\n\t\tsab3.setFromPoints( axis3, arr );\r\n\r\n\t\tthis.sphere.setFromPoints( this.points );\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.closestPointToSegment = ( function () {\r\n\r\n\tconst point1 = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst edge = new Line3();\r\n\r\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tconst { start, end } = segment;\r\n\t\tconst points = this.points;\r\n\t\tlet distSq;\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check the triangle edges\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst nexti = ( i + 1 ) % 3;\r\n\t\t\tedge.start.copy( points[ i ] );\r\n\t\t\tedge.end.copy( points[ nexti ] );\r\n\r\n\t\t\tclosestPointsSegmentToSegment( edge, segment, point1, point2 );\r\n\r\n\t\t\tdistSq = point1.distanceToSquared( point2 );\r\n\t\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = distSq;\r\n\t\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// check end points\r\n\t\tthis.closestPointToPoint( start, point1 );\r\n\t\tdistSq = start.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( start );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closestPointToPoint( end, point1 );\r\n\t\tdistSq = end.distanceToSquared( point1 );\r\n\t\tif ( distSq < closestDistanceSq ) {\r\n\r\n\t\t\tclosestDistanceSq = distSq;\r\n\t\t\tif ( target1 ) target1.copy( point1 );\r\n\t\t\tif ( target2 ) target2.copy( end );\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nSeparatingAxisTriangle.prototype.intersectsTriangle = ( function () {\r\n\r\n\tconst saTri2 = new SeparatingAxisTriangle();\r\n\tconst arr1 = new Array( 3 );\r\n\tconst arr2 = new Array( 3 );\r\n\tconst cachedSatBounds = new SeparatingAxisBounds();\r\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\r\n\tconst cachedAxis = new Vector3();\r\n\treturn function intersectsTriangle( other ) {\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! other.isSeparatingAxisTriangle ) {\r\n\r\n\t\t\tsaTri2.copy( other );\r\n\t\t\tsaTri2.update();\r\n\t\t\tother = saTri2;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds1 = this.satBounds;\r\n\t\tconst satAxes1 = this.satAxes;\r\n\t\tarr2[ 0 ] = other.a;\r\n\t\tarr2[ 1 ] = other.b;\r\n\t\tarr2[ 2 ] = other.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds1[ i ];\r\n\t\t\tconst sa = satAxes1[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\tconst satBounds2 = other.satBounds;\r\n\t\tconst satAxes2 = other.satAxes;\r\n\t\tarr1[ 0 ] = this.a;\r\n\t\tarr1[ 1 ] = this.b;\r\n\t\tarr1[ 2 ] = this.c;\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sb = satBounds2[ i ];\r\n\t\t\tconst sa = satAxes2[ i ];\r\n\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\r\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\t// check crossed axes\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst sa1 = satAxes1[ i ];\r\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\r\n\r\n\t\t\t\tconst sa2 = satAxes2[ i2 ];\r\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\r\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\r\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\r\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToPoint = ( function () {\r\n\r\n\tconst target = new Vector3();\r\n\treturn function distanceToPoint( point ) {\r\n\r\n\t\tthis.closestPointToPoint( point, target );\r\n\t\treturn point.distanceTo( target );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n\r\nSeparatingAxisTriangle.prototype.distanceToTriangle = ( function () {\r\n\r\n\tconst point = new Vector3();\r\n\tconst point2 = new Vector3();\r\n\tconst cornerFields = [ 'a', 'b', 'c' ];\r\n\tconst line1 = new Line3();\r\n\tconst line2 = new Line3();\r\n\r\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\r\n\r\n\t\tif ( other.needsUpdate ) {\r\n\r\n\t\t\tother.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.needsUpdate ) {\r\n\r\n\t\t\tthis.update();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.intersectsTriangle( other ) ) {\r\n\r\n\t\t\t// TODO: This will not result in a point that lies on\r\n\t\t\t// the intersection line of the triangles\r\n\t\t\tif ( target1 || target2 ) {\r\n\r\n\t\t\t\tthis.getMidpoint( point );\r\n\t\t\t\tother.closestPointToPoint( point, point2 );\r\n\t\t\t\tthis.closestPointToPoint( point2, point );\r\n\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tlet closestDistanceSq = Infinity;\r\n\r\n\t\t// check all point distances\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tlet dist;\r\n\t\t\tconst field = cornerFields[ i ];\r\n\t\t\tconst otherVec = other[ field ];\r\n\t\t\tthis.closestPointToPoint( otherVec, point );\r\n\r\n\t\t\tdist = otherVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst thisVec = this[ field ];\r\n\t\t\tother.closestPointToPoint( thisVec, point );\r\n\r\n\t\t\tdist = thisVec.distanceToSquared( point );\r\n\r\n\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\r\n\t\t\t\tif ( target2 ) target2.copy( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\tconst f11 = cornerFields[ i ];\r\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\r\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\r\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\r\n\r\n\t\t\t\tconst f21 = cornerFields[ i2 ];\r\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\r\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\r\n\r\n\t\t\t\tclosestPointsSegmentToSegment( line1, line2, point, point2 );\r\n\r\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\r\n\t\t\t\tif ( dist < closestDistanceSq ) {\r\n\r\n\t\t\t\t\tclosestDistanceSq = dist;\r\n\t\t\t\t\tif ( target1 ) target1.copy( point );\r\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Math.sqrt( closestDistanceSq );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n","import { Box3, Vector3, Matrix4, Sphere, Line3 } from 'three';\nimport { SeparatingAxisBounds } from './SeparatingAxisBounds.js';\nimport { SeparatingAxisTriangle } from './SeparatingAxisTriangle.js';\nimport { closestPointsSegmentToSegment } from './MathUtilities.js';\n\nexport class OrientedBox extends Box3 {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.matrix = new Matrix4();\n\t\tthis.invMatrix = new Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new SeparatingAxisBounds() );\n\t\tthis.sphere = new Sphere();\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tsuper.set( min, max );\n\t\tthis.matrix = matrix;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tsuper.copy( other );\n\t\tthis.matrix.copy( other.matrix );\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.sphere.setFromPoints( this.points );\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\tif ( ! box.intersectsSphere( this.sphere ) ) return false;\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new SeparatingAxisTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new SeparatingAxisBounds();\n\tconst cachedAxis = new Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( ! triangle.isSeparatingAxisTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new Line3() );\n\n\tconst point1 = new Vector3();\n\tconst point2 = new Vector3();\n\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\tclosestPointsSegmentToSegment( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n","// sets the vertices of triangle `tri` with the 3 vertices after i\r\nexport function setTriangle( tri, i, index, pos ) {\r\n\r\n\tconst ta = tri.a;\r\n\tconst tb = tri.b;\r\n\tconst tc = tri.c;\r\n\r\n\tlet i3 = index.getX( i );\r\n\tta.x = pos.getX( i3 );\r\n\tta.y = pos.getY( i3 );\r\n\tta.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 1 );\r\n\ttb.x = pos.getX( i3 );\r\n\ttb.y = pos.getY( i3 );\r\n\ttb.z = pos.getZ( i3 );\r\n\r\n\ti3 = index.getX( i + 2 );\r\n\ttc.x = pos.getX( i3 );\r\n\ttc.y = pos.getY( i3 );\r\n\ttc.z = pos.getZ( i3 );\r\n\r\n}\r\n","import { Vector3, Vector2, Triangle, DoubleSide, BackSide } from 'three';\r\n\r\n// Ripped and modified From THREE.js Mesh raycast\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\r\nvar vA = new Vector3();\r\nvar vB = new Vector3();\r\nvar vC = new Vector3();\r\n\r\nvar uvA = new Vector2();\r\nvar uvB = new Vector2();\r\nvar uvC = new Vector2();\r\n\r\nvar intersectionPoint = new Vector3();\r\nvar intersectionPointWorld = new Vector3();\r\n\r\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tvar intersect;\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\tintersectionPointWorld.copy( point );\r\n\tintersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {\r\n\r\n\tvA.fromBufferAttribute( position, a );\r\n\tvB.fromBufferAttribute( position, b );\r\n\tvC.fromBufferAttribute( position, c );\r\n\r\n\tvar intersection = checkIntersection( object, object.material, raycaster, ray, vA, vB, vC, intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\tuvA.fromBufferAttribute( uv, a );\r\n\t\t\tuvB.fromBufferAttribute( uv, b );\r\n\t\t\tuvC.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new Vector2( ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3( ),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( vA, vB, vC, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\t\tintersection.faceIndex = a;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\r\nfunction intersectTri( mesh, geo, raycaster, ray, tri, intersections ) {\r\n\r\n\tconst triOffset = tri * 3;\r\n\tconst a = geo.index.getX( triOffset );\r\n\tconst b = geo.index.getX( triOffset + 1 );\r\n\tconst c = geo.index.getX( triOffset + 2 );\r\n\r\n\tconst intersection = checkBufferGeometryIntersection( mesh, raycaster, ray, geo.attributes.position, geo.attributes.uv, a, b, c );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tintersection.faceIndex = tri;\r\n\t\tif ( intersections ) intersections.push( intersection );\r\n\t\treturn intersection;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n}\r\n\r\nexport { intersectTri };\r\n","import { intersectTri } from './ThreeIntersectionUtilities.js';\r\n\r\nexport function intersectTris( mesh, geo, raycaster, ray, offset, count, intersections ) {\r\n\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tintersectTri( mesh, geo, raycaster, ray, i, intersections );\r\n\r\n\t}\r\n\r\n};\r\n\r\nexport function intersectClosestTri( mesh, geo, raycaster, ray, offset, count ) {\r\n\r\n\tlet dist = Infinity;\r\n\tlet res = null;\r\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\r\n\r\n\t\tconst intersection = intersectTri( mesh, geo, raycaster, ray, i );\r\n\t\tif ( intersection && intersection.distance < dist ) {\r\n\r\n\t\t\tres = intersection;\r\n\t\t\tdist = intersection.distance;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn res;\r\n\r\n};\r\n","import { setTriangle } from './TriangleUtils.js';\r\n\r\nexport function arrayToBox( nodeIndex32, array, target ) {\r\n\r\n\ttarget.min.x = array[ nodeIndex32 ];\r\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\r\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\r\n\r\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\r\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\r\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\r\n\r\n}\r\n\r\nexport function iterateOverTriangles(\r\n\toffset,\r\n\tcount,\r\n\tgeometry,\r\n\tintersectsTriangleFunc,\r\n\tcontained,\r\n\tdepth,\r\n\ttriangle\r\n) {\r\n\r\n\tconst index = geometry.index;\r\n\tconst pos = geometry.attributes.position;\r\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\r\n\r\n\t\tsetTriangle( triangle, i * 3, index, pos );\r\n\t\ttriangle.needsUpdate = true;\r\n\r\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n","/* Generated from \"castFunctions.template.js\". Do not edit. */\r\n\r\n// For speed and readability this script is processed to replace the macro-like calls\r\n// with inline buffer reads. See generate-cast-functions.js.\r\nimport { Box3, Vector3, Mesh, Matrix4 } from 'three';\r\nimport { intersectTris, intersectClosestTri } from './Utils/RayIntersectTriUtlities.js';\r\nimport { arrayToBox } from './Utils/BufferNodeUtils.js';\r\n\r\nimport { OrientedBox } from './Utils/OrientedBox.js';\r\nimport { setTriangle } from './Utils/TriangleUtils.js';\r\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\r\nimport { CONTAINED } from './Constants.js';\r\n\r\nconst boundingBox = new Box3();\r\nconst boxIntersection = new Vector3();\r\nconst xyzFields = [ 'x', 'y', 'z' ];\r\n\r\nexport function raycast( nodeIndex32, mesh, geometry, raycaster, ray, intersects ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\tintersectTris( mesh, geometry, raycaster, ray, offset, count, intersects );\r\n\r\n\t} else {\r\n\r\n\t\tconst leftIndex = nodeIndex32 + 8;\r\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( leftIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t\tconst rightIndex = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\r\n\r\n\t\t\traycast( rightIndex, mesh, geometry, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport function raycastFirst( nodeIndex32, mesh, geometry, raycaster, ray ) {\r\n\r\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\tif ( isLeaf ) {\r\n\r\n\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\treturn intersectClosestTri( mesh, geometry, raycaster, ray, offset, count );\r\n\r\n\t} else {\r\n\r\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\r\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\r\n\t\tconst splitAxis = uint32Array[ nodeIndex32 + 7 ];\r\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\r\n\t\tconst rayDir = ray.direction[ xyzAxis ];\r\n\t\tconst leftToRight = rayDir >= 0;\r\n\r\n\t\t// c1 is the child to check first\r\n\t\tlet c1, c2;\r\n\t\tif ( leftToRight ) {\r\n\r\n\t\t\tc1 = nodeIndex32 + 8;\r\n\t\t\tc2 = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\tc1 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tc2 = nodeIndex32 + 8;\r\n\r\n\t\t}\r\n\r\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\r\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\r\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\r\n\t\tif ( c1Result ) {\r\n\r\n\t\t\t// check if the point is within the second bounds\r\n\t\t\tconst point = c1Result.point[ xyzAxis ];\r\n\t\t\tconst isOutside = leftToRight ?\r\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\r\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\r\n\r\n\t\t\tif ( isOutside ) {\r\n\r\n\t\t\t\treturn c1Result;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// either there was no intersection in the first node, or there could still be a closer\r\n\t\t// intersection in the second, so check the second node and then take the better of the two\r\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\r\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, mesh, geometry, raycaster, ray ) : null;\r\n\r\n\t\tif ( c1Result && c2Result ) {\r\n\r\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn c1Result || c2Result || null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nexport const shapecast = ( function () {\r\n\r\n\tconst _triangle = new SeparatingAxisTriangle();\r\n\tconst _cachedBox1 = new Box3();\r\n\tconst _cachedBox2 = new Box3();\r\n\r\n\treturn function shapecast(\r\n\t\tnodeIndex32,\r\n\t\tmesh,\r\n\t\tgeometry,\r\n\t\tintersectsBoundsFunc,\r\n\t\tintersectsRangeFunc,\r\n\t\tnodeScoreFunc = null,\r\n\t\tnodeIndexByteOffset = 0, // offset for unique node identifier\r\n\t\tdepth = 0,\r\n\t\ttriangle = _triangle,\r\n\t\tcachedBox1 = _cachedBox1,\r\n\t\tcachedBox2 = _cachedBox2\r\n\t) {\r\n\r\n\t\t// Define these inside the function so it has access to the local variables needed\r\n\t\t// when converting to the buffer equivalents\r\n\t\tfunction getLeftOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\tnodeIndex32 = nodeIndex32 + 8;\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\r\n\r\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\t\t// traverse until we find a leaf\r\n\t\t\twhile ( ! ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF ) ) {\r\n\r\n\t\t\t\t// adjust offset to point to the right node\r\n\t\t\t\tnodeIndex32 = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// return the end offset of the triangle range\r\n\t\t\treturn uint32Array[ nodeIndex32 + 6 ] + uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndex32 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tlet c1 = left;\r\n\t\t\tlet c2 = right;\r\n\r\n\t\t\tlet score1, score2;\r\n\t\t\tlet box1, box2;\r\n\t\t\tif ( nodeScoreFunc ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tbox2 = cachedBox2;\r\n\r\n\t\t\t\t// bounding data is not offset\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\t\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\r\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\r\n\r\n\t\t\t\tif ( score2 < score1 ) {\r\n\r\n\t\t\t\t\tc1 = right;\r\n\t\t\t\t\tc2 = left;\r\n\r\n\t\t\t\t\tconst temp = score1;\r\n\t\t\t\t\tscore1 = score2;\r\n\t\t\t\t\tscore2 = temp;\r\n\r\n\t\t\t\t\tbox1 = box2;\r\n\t\t\t\t\t// box2 is always set before use below\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Check box 1 intersection\r\n\t\t\tif ( ! box1 ) {\r\n\r\n\t\t\t\tbox1 = cachedBox1;\r\n\t\t\t\tarrayToBox( c1, float32Array, box1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst isC1Leaf = ( uint16Array[ c1 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 );\r\n\r\n\t\t\tlet c1StopTraversal;\r\n\t\t\tif ( c1Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c1 );\r\n\t\t\t\tconst end = getRightEndOffset( c1 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc1StopTraversal =\r\n\t\t\t\t\tc1Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc1,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tnodeIndexByteOffset,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c1StopTraversal ) return true;\r\n\r\n\t\t\t// Check box 2 intersection\r\n\t\t\t// cached box2 will have been overwritten by previous traversal\r\n\t\t\tbox2 = cachedBox2;\r\n\t\t\tarrayToBox( c2, float32Array, box2 );\r\n\r\n\t\t\tconst isC2Leaf = ( uint16Array[ c2 * 2 + 15 ] === 0xFFFF );\r\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 );\r\n\r\n\t\t\tlet c2StopTraversal;\r\n\t\t\tif ( c2Intersection === CONTAINED ) {\r\n\r\n\t\t\t\tconst offset = getLeftOffset( c2 );\r\n\t\t\t\tconst end = getRightEndOffset( c2 );\r\n\t\t\t\tconst count = end - offset;\r\n\r\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tc2StopTraversal =\r\n\t\t\t\t\tc2Intersection &&\r\n\t\t\t\t\tshapecast(\r\n\t\t\t\t\t\tc2,\r\n\t\t\t\t\t\tmesh,\r\n\t\t\t\t\t\tgeometry,\r\n\t\t\t\t\t\tintersectsBoundsFunc,\r\n\t\t\t\t\t\tintersectsRangeFunc,\r\n\t\t\t\t\t\tnodeScoreFunc,\r\n\t\t\t\t\t\tnodeIndexByteOffset,\r\n\t\t\t\t\t\tdepth + 1,\r\n\t\t\t\t\t\ttriangle,\r\n\t\t\t\t\t\tcachedBox1,\r\n\t\t\t\t\t\tcachedBox2\r\n\t\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( c2StopTraversal ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nexport const intersectsGeometry = ( function () {\r\n\r\n\tconst triangle = new SeparatingAxisTriangle();\r\n\tconst triangle2 = new SeparatingAxisTriangle();\r\n\tconst cachedMesh = new Mesh();\r\n\tconst invertedMat = new Matrix4();\r\n\r\n\tconst obb = new OrientedBox();\r\n\tconst obb2 = new OrientedBox();\r\n\r\n\treturn function intersectsGeometry( nodeIndex32, mesh, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\r\n\r\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\r\n\r\n\t\tif ( cachedObb === null ) {\r\n\r\n\t\t\tif ( ! otherGeometry.boundingBox ) {\r\n\r\n\t\t\t\totherGeometry.computeBoundingBox();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\r\n\t\t\tobb.update();\r\n\t\t\tcachedObb = obb;\r\n\r\n\t\t}\r\n\r\n\t\tconst isLeaf = ( uint16Array[ nodeIndex16 + 15 ] === 0xFFFF );\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tconst thisGeometry = geometry;\r\n\t\t\tconst thisIndex = thisGeometry.index;\r\n\t\t\tconst thisPos = thisGeometry.attributes.position;\r\n\r\n\t\t\tconst index = otherGeometry.index;\r\n\t\t\tconst pos = otherGeometry.attributes.position;\r\n\r\n\t\t\tconst offset = uint32Array[ nodeIndex32 + 6 ];\r\n\t\t\tconst count = uint16Array[ nodeIndex16 + 14 ];\r\n\r\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\r\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\r\n\t\t\t// here.\r\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\r\n\r\n\t\t\tif ( otherGeometry.boundsTree ) {\r\n\r\n\t\t\t\tarrayToBox( nodeIndex32, float32Array, obb2 );\r\n\t\t\t\tobb2.matrix.copy( invertedMat );\r\n\t\t\t\tobb2.update();\r\n\r\n\t\t\t\tcachedMesh.geometry = otherGeometry;\r\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( cachedMesh, {\r\n\r\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\r\n\r\n\t\t\t\t\tintersectsTriangle: tri => {\r\n\r\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\r\n\t\t\t\t\t\ttri.update();\r\n\r\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\t\t\tsetTriangle( triangle2, i, thisIndex, thisPos );\r\n\t\t\t\t\t\t\ttriangle2.update();\r\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\t\t\t\tcachedMesh.geometry = null;\r\n\r\n\t\t\t\treturn res;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\r\n\t\t\t\t\tsetTriangle( triangle, i, thisIndex, thisPos );\r\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\r\n\t\t\t\t\ttriangle.update();\r\n\r\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\r\n\r\n\t\t\t\t\t\tsetTriangle( triangle2, i2, index, pos );\r\n\t\t\t\t\t\ttriangle2.update();\r\n\r\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\r\n\r\n\t\t\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst left = nodeIndex32 + 8;\r\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\r\n\r\n\t\t\tarrayToBox( left, float32Array, boundingBox );\r\n\t\t\tconst leftIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( left, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( leftIntersection ) return true;\r\n\r\n\t\t\tarrayToBox( right, float32Array, boundingBox );\r\n\t\t\tconst rightIntersection =\r\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\r\n\t\t\t\tintersectsGeometry( right, mesh, geometry, otherGeometry, geometryToBvh, cachedObb );\r\n\r\n\t\t\tif ( rightIntersection ) return true;\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nfunction intersectRay( nodeIndex32, array, ray, target ) {\r\n\r\n\tarrayToBox( nodeIndex32, array, boundingBox );\r\n\treturn ray.intersectBox( boundingBox, target );\r\n\r\n}\r\n\r\nconst bufferStack = [];\r\nlet _prevBuffer;\r\nlet _float32Array;\r\nlet _uint16Array;\r\nlet _uint32Array;\r\nexport function setBuffer( buffer ) {\r\n\r\n\tif ( _prevBuffer ) {\r\n\r\n\t\tbufferStack.push( _prevBuffer );\r\n\r\n\t}\r\n\r\n\t_prevBuffer = buffer;\r\n\t_float32Array = new Float32Array( buffer );\r\n\t_uint16Array = new Uint16Array( buffer );\r\n\t_uint32Array = new Uint32Array( buffer );\r\n\r\n}\r\n\r\nexport function clearBuffer() {\r\n\r\n\t_prevBuffer = null;\r\n\t_float32Array = null;\r\n\t_uint16Array = null;\r\n\t_uint32Array = null;\r\n\r\n\tif ( bufferStack.length ) {\r\n\r\n\t\tsetBuffer( bufferStack.pop() );\r\n\r\n\t}\r\n\r\n}\r\n","import { Vector3, BufferAttribute, Box3 } from 'three';\nimport { CENTER } from './Constants.js';\nimport { BYTES_PER_NODE, IS_LEAFNODE_FLAG, buildPackedTree } from './buildFunctions.js';\nimport { OrientedBox } from './Utils/OrientedBox.js';\nimport { SeparatingAxisTriangle } from './Utils/SeparatingAxisTriangle.js';\nimport { setTriangle } from './Utils/TriangleUtils.js';\nimport {\n\traycast,\n\traycastFirst,\n\tshapecast,\n\tintersectsGeometry,\n\tsetBuffer,\n\tclearBuffer,\n} from './castFunctions.js';\nimport { arrayToBox, iterateOverTriangles } from './Utils/BufferNodeUtils.js';\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst obb = new OrientedBox();\nconst temp = new Vector3();\nconst tri2 = new SeparatingAxisTriangle();\nconst temp1 = new Vector3();\nconst temp2 = new Vector3();\nconst tempBox = new Box3();\nconst triangle = new SeparatingAxisTriangle();\n\nexport default class MeshBVH {\n\n\tstatic serialize( bvh, geometry, copyIndexBuffer = true ) {\n\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tconst result = {\n\t\t\troots: rootData,\n\t\t\tindex: copyIndexBuffer ? indexAttribute.array.slice() : indexAttribute.array,\n\t\t};\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, setIndex = true ) {\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.attributes.position.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\n\t\t\tsetBoundingBox: true,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false\n\n\t\t}, options );\n\t\toptions.strategy = Math.max( 0, Math.min( 2, options.strategy ) );\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = buildPackedTree( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null, terminationIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tif ( terminationIndices && Array.isArray( terminationIndices ) ) {\n\n\t\t\tterminationIndices = new Set( terminationIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posArr = geometry.attributes.position.array;\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tlet byteOffset = 0;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t\t_traverse( 0, byteOffset );\n\t\t\tbyteOffset += buffer.byteLength;\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index3 = indexArr[ i ] * 3;\n\t\t\t\t\tconst x = posArr[ index3 + 0 ];\n\t\t\t\t\tconst y = posArr[ index3 + 1 ];\n\t\t\t\t\tconst z = posArr[ index3 + 2 ];\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\t// the indentifying node indices provided by the shapecast function include offsets of all\n\t\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\t\tconst offsetRight = right + byteOffset;\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tlet forceLeft = force || terminationIndices && terminationIndices.has( offsetLeft );\n\t\t\t\tlet traverseLeft = forceLeft || ( nodeIndices ? nodeIndices.has( offsetLeft ) : true );\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, byteOffset, forceLeft );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tlet forceRight = force || terminationIndices && terminationIndices.has( offsetRight );\n\t\t\t\tlet traverseRight = forceRight || ( nodeIndices ? nodeIndices.has( offsetRight ) : true );\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, byteOffset, forceRight );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( mesh, raycaster, ray, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\traycast( 0, mesh, geometry, raycaster, ray, intersects );\n\t\t\tclearBuffer();\n\n\t\t}\n\n\t}\n\n\traycastFirst( mesh, raycaster, ray ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet closestResult = null;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tconst result = raycastFirst( 0, mesh, geometry, raycaster, ray );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( mesh, otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = intersectsGeometry( 0, mesh, geometry, otherGeometry, geomToMesh );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( mesh, callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.' );\n\n\t\t}\n\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn iterateOverTriangles( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tlet byteOffset = 0;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\tsetBuffer( root );\n\t\t\tresult = shapecast( 0, mesh, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\t\t\tclearBuffer();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tbyteOffset += root.byteLength;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( mesh, box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.update();\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( mesh, sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( mesh, otherGeometry, geometryToBvh, target1 = null, target2 = null, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.update();\n\n\t\tconst pos = otherGeometry.attributes.position;\n\t\tconst index = otherGeometry.index;\n\n\t\tlet tempTarget1 = null;\n\t\tlet tempTarget2 = null;\n\t\tif ( target1 ) {\n\n\t\t\ttempTarget1 = temp1;\n\n\t\t}\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp2;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tthis.shapecast(\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box, Math.min( closestDistance, maxThreshold ) );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\tif ( tri.needsUpdate ) {\n\n\t\t\t\t\t\ttri.update();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sphere1 = tri.sphere;\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\tsetTriangle( tri2, i2, index, pos );\n\t\t\t\t\t\ttri2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri2.sphere.setFromPoints( tri2.points );\n\n\t\t\t\t\t\tconst sphere2 = tri2.sphere;\n\t\t\t\t\t\tconst sphereDist = sphere2.center.distanceTo( sphere1.center ) - sphere2.radius - sphere1.radius;\n\t\t\t\t\t\tif ( sphereDist > closestDistance ) {\n\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttri2.update();\n\n\t\t\t\t\t\tconst dist = tri.distanceToTriangle( tri2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\tif ( target1 ) {\n\n\t\t\t\t\t\t\t\ttarget1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( target2 ) {\n\n\t\t\t\t\t\t\t\ttarget2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tclosestDistance = dist;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn closestDistance;\n\n\t}\n\n\tdistanceToGeometry( mesh, geom, matrix, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToGeometry( mesh, geom, matrix, null, null, minThreshold, maxThreshold );\n\n\t}\n\n\tclosestPointToPoint( mesh, point, target, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tthis.shapecast(\n\n\t\t\tmesh,\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\tif ( target ) {\n\n\t\t\t\t\t\t\ttarget.copy( temp );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t}\n\n\tdistanceToPoint( mesh, point, minThreshold, maxThreshold ) {\n\n\t\treturn this.closestPointToPoint( mesh, point, null, minThreshold, maxThreshold );\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\tarrayToBox( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { LineBasicMaterial, Box3Helper, Box3, Group, LineSegments } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\n\r\nconst wiremat = new LineBasicMaterial( { color: 0x00FF88, transparent: true, opacity: 0.3 } );\r\nconst boxGeom = new Box3Helper().geometry;\r\nlet boundingBox = new Box3();\r\n\r\nclass MeshBVHRootVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10, group = 0 ) {\r\n\r\n\t\tsuper( 'MeshBVHRootVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._group = group;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\r\n\t\tlet requiredChildren = 0;\r\n\t\tif ( boundsTree ) {\r\n\r\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, countOrIsUnfinished ) => {\r\n\r\n\t\t\t\tlet isTerminal = isLeaf || countOrIsUnfinished;\r\n\r\n\t\t\t\t// Stop traversal\r\n\t\t\t\tif ( depth >= this.depth ) {\r\n\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( depth === this.depth - 1 || isTerminal ) {\r\n\r\n\t\t\t\t\tlet m = requiredChildren < this.children.length ? this.children[ requiredChildren ] : null;\r\n\t\t\t\t\tif ( ! m ) {\r\n\r\n\t\t\t\t\t\tm = new LineSegments( boxGeom, wiremat );\r\n\t\t\t\t\t\tm.raycast = () => [];\r\n\t\t\t\t\t\tthis.add( m );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequiredChildren ++;\r\n\t\t\t\t\tarrayToBox( boundingData, boundingBox );\r\n\t\t\t\t\tboundingBox.getCenter( m.position );\r\n\t\t\t\t\tm.scale.subVectors( boundingBox.max, boundingBox.min ).multiplyScalar( 0.5 );\r\n\r\n\t\t\t\t\tif ( m.scale.x === 0 ) m.scale.x = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.y === 0 ) m.scale.y = Number.EPSILON;\r\n\t\t\t\t\tif ( m.scale.z === 0 ) m.scale.z = Number.EPSILON;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\twhile ( this.children.length > requiredChildren ) this.remove( this.children.pop() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBVHVisualizer extends Group {\r\n\r\n\tconstructor( mesh, depth = 10 ) {\r\n\r\n\t\tsuper( 'MeshBVHVisualizer' );\r\n\r\n\t\tthis.depth = depth;\r\n\t\tthis.mesh = mesh;\r\n\t\tthis._roots = [];\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bvh = this.mesh.geometry.boundsTree;\r\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\r\n\t\twhile ( this._roots.length > totalRoots ) {\r\n\r\n\t\t\tthis._roots.pop();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\r\n\r\n\t\t\tif ( i >= this._roots.length ) {\r\n\r\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.depth, i );\r\n\t\t\t\tthis.add( root );\r\n\t\t\t\tthis._roots.push( root );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet root = this._roots[ i ];\r\n\t\t\t\troot.depth = this.depth;\r\n\t\t\t\troot.mesh = this.mesh;\r\n\t\t\t\troot.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( ...args ) {\r\n\r\n\t\tthis.position.copy( this.mesh.position );\r\n\t\tthis.rotation.copy( this.mesh.rotation );\r\n\t\tthis.scale.copy( this.mesh.scale );\r\n\r\n\t\tsuper.updateMatrixWorld( ...args );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.depth = source.depth;\r\n\t\tthis.mesh = source.mesh;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default MeshBVHVisualizer;\r\n","// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\r\nfunction getPrimitiveSize( el ) {\r\n\r\n\tswitch ( typeof el ) {\r\n\r\n\t\tcase 'number':\r\n\t\t\treturn 8;\r\n\t\tcase 'string':\r\n\t\t\treturn el.length * 2;\r\n\t\tcase 'boolean':\r\n\t\t\treturn 4;\r\n\t\tdefault:\r\n\t\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isTypedArray( arr ) {\r\n\r\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\r\n\treturn regex.test( arr.constructor.name );\r\n\r\n}\r\n\r\nfunction getRootExtremes( bvh, group ) {\r\n\r\n\tconst result = {\r\n\t\ttotal: 0,\r\n\t\tdepth: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\ttris: {\r\n\t\t\tmin: Infinity, max: - Infinity\r\n\t\t},\r\n\t\tsplits: [ 0, 0, 0 ]\r\n\t};\r\n\r\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\r\n\r\n\t\tresult.total ++;\r\n\t\tif ( isLeaf ) {\r\n\r\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\r\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\r\n\r\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\r\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.splits[ offsetOrSplit ] ++;\r\n\r\n\t\t}\r\n\r\n\t}, group );\r\n\r\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\r\n\tif ( result.tris.min === Infinity ) {\r\n\r\n\t\tresult.tris.min = 0;\r\n\t\tresult.tris.max = 0;\r\n\r\n\t}\r\n\r\n\tif ( result.depth.min === Infinity ) {\r\n\r\n\t\tresult.depth.min = 0;\r\n\t\tresult.depth.max = 0;\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\nfunction getBVHExtremes( bvh ) {\r\n\r\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\r\n\r\n}\r\n\r\nfunction estimateMemoryInBytes( obj ) {\r\n\r\n\tconst traversed = new Set();\r\n\tconst stack = [ obj ];\r\n\tlet bytes = 0;\r\n\r\n\twhile ( stack.length ) {\r\n\r\n\t\tconst curr = stack.pop();\r\n\t\tif ( traversed.has( curr ) ) {\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\t\ttraversed.add( curr );\r\n\r\n\t\tfor ( let key in curr ) {\r\n\r\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbytes += getPrimitiveSize( key );\r\n\r\n\t\t\tconst value = curr[ key ];\r\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\r\n\r\n\t\t\t\tif ( isTypedArray( value ) ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\r\n\r\n\t\t\t\t\tbytes += value.byteLength;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstack.push( value );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbytes += getPrimitiveSize( value );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn bytes;\r\n\r\n}\r\n\r\nexport { estimateMemoryInBytes, getBVHExtremes };\r\n","import { Box3, Vector3 } from 'three';\r\nimport { arrayToBox } from './Utils/ArrayBoxUtilities.js';\r\nconst box1 = new Box3();\r\nconst box2 = new Box3();\r\nconst vec = new Vector3();\r\n\r\nexport class MeshBVHDebug {\r\n\r\n\tconstructor( bvh, geometry ) {\r\n\r\n\t\tthis.bvh = bvh;\r\n\t\tthis.geometry = geometry;\r\n\r\n\t}\r\n\r\n\t// Returns a simple, human readable object that represents the BVH.\r\n\tgetJSONStructure() {\r\n\r\n\t\tconst { bvh } = this;\r\n\t\tconst depthStack = [];\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tbounds: arrayToBox( boundingData, new Box3() ),\r\n\t\t\t};\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\tinfo.count = count;\r\n\t\t\t\tinfo.offset = offset;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tinfo.left = null;\r\n\t\t\t\tinfo.right = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\t// traversal hits the left then right node\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\tif ( parent.left === null ) {\r\n\r\n\t\t\t\t\tparent.left = info;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tparent.right = info;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn depthStack[ 0 ];\r\n\r\n\t}\r\n\r\n\tvalidateBounds() {\r\n\r\n\t\tconst { bvh, geometry } = this;\r\n\t\tconst depthStack = [];\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tlet passes = true;\r\n\r\n\t\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\r\n\r\n\t\t\tconst info = {\r\n\t\t\t\tdepth,\r\n\t\t\t\tisLeaf,\r\n\t\t\t\tboundingData,\r\n\t\t\t\toffset,\r\n\t\t\t\tcount,\r\n\t\t\t};\r\n\t\t\tdepthStack[ depth ] = info;\r\n\r\n\t\t\tarrayToBox( boundingData, box1 );\r\n\t\t\tconst parent = depthStack[ depth - 1 ];\r\n\r\n\t\t\tif ( isLeaf ) {\r\n\r\n\t\t\t\t// check triangles\r\n\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\tconst i0 = index.getX( i );\r\n\t\t\t\t\tconst i1 = index.getX( i + 1 );\r\n\t\t\t\t\tconst i2 = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tlet isContained;\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i0 );\r\n\t\t\t\t\tisContained = box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i1 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tvec.fromBufferAttribute( position, i2 );\r\n\t\t\t\t\tisContained = isContained && box1.containsPoint( vec );\r\n\r\n\t\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\r\n\t\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( parent ) {\r\n\r\n\t\t\t\t// check if my bounds fit in my parents\r\n\t\t\t\tarrayToBox( boundingData, box2 );\r\n\r\n\t\t\t\tconst isContained = box2.containsBox( box1 );\r\n\t\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\r\n\t\t\t\tpasses = passes && isContained;\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\treturn passes;\r\n\r\n\t}\r\n\r\n}\r\n","import { Ray, Matrix4, Mesh } from 'three';\r\nimport MeshBVH from './MeshBVH.js';\r\nimport Visualizer from './MeshBVHVisualizer.js';\r\nimport { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './Constants.js';\r\nimport { getBVHExtremes, estimateMemoryInBytes } from './Utils/Debug.js';\r\nimport { MeshBVHDebug } from './MeshBVHDebug.js';\r\n\r\nconst ray = new Ray();\r\nconst tmpInverseMatrix = new Matrix4();\r\nconst origMeshRaycastFunc = Mesh.prototype.raycast;\r\n\r\nfunction acceleratedRaycast( raycaster, intersects ) {\r\n\r\n\tif ( this.geometry.boundsTree ) {\r\n\r\n\t\tif ( this.material === undefined ) return;\r\n\r\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\r\n\r\n\t\tif ( raycaster.firstHitOnly === true ) {\r\n\r\n\t\t\tconst res = this.geometry.boundsTree.raycastFirst( this, raycaster, ray );\r\n\t\t\tif ( res ) intersects.push( res );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.geometry.boundsTree.raycast( this, raycaster, ray, intersects );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction computeBoundsTree( options ) {\r\n\r\n\tthis.boundsTree = new MeshBVH( this, options );\r\n\treturn this.boundsTree;\r\n\r\n}\r\n\r\nfunction disposeBoundsTree() {\r\n\r\n\tthis.boundsTree = null;\r\n\r\n}\r\n\r\nexport {\r\n\tMeshBVH, Visualizer, Visualizer as MeshBVHVisualizer, MeshBVHDebug,\r\n\tacceleratedRaycast, computeBoundsTree, disposeBoundsTree,\r\n\tCENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED,\r\n\testimateMemoryInBytes, getBVHExtremes\r\n};\r\n"],"names":["Box3","BufferAttribute","Vector3","Vector2","Plane","Line3","Triangle","Sphere","Matrix4","BackSide","DoubleSide","arrayToBox","xyzFields","Mesh","LineBasicMaterial","Box3Helper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AAC;CAChD,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC;;CAExB,CAAC;;CAED,SAAS,iBAAiB,GAAG;;CAE7B,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;CAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index 3eae58c01..a80d1bc26 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -4,7 +4,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var define; var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof e&&e.amd?e(n):t.Stats=n()}(this,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;to+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var l=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,s=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,s,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p,u,s,m),{dom:h,update:function(f,y){l=Math.min(l,f),i=Math.max(i,f),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(a(f)+" "+e+" ("+a(l)+"-"+a(i)+")",c,d),v.drawImage(h,p+o,u,s-o,m,p,u,s-o,m),v.fillRect(p+s-o,u,o,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p+s-o,u,o,a((1-f/y)*m))}}},e}); },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"tuIt":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CONTAINED=exports.INTERSECTED=exports.NOT_INTERSECTED=exports.SAH=exports.AVERAGE=exports.CENTER=void 0;var r=0;exports.CENTER=r;var E=1;exports.AVERAGE=E;var e=2;exports.SAH=e;var t=0;exports.NOT_INTERSECTED=t;var o=1;exports.INTERSECTED=o;var s=2;exports.CONTAINED=s; },{}],"qYFu":[function(require,module,exports) { @@ -12,15 +12,15 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"dbR2":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GenerateMeshBVHWorker=void 0;var e=require("three"),r=n(require("../MeshBVH.js"));function n(e){return e&&e.__esModule?e:{default:e}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");var o=this.worker;return this.running=!0,new Promise(function(a,u){o.onmessage=function(s){t.running=!1,o.onmessage=null;var f=s.data,l=f.serialized,d=f.position,c=f.error;if(c)u(new Error(c));else{var h=r.default.deserialize(l,n,!1),g=Object.assign({setBoundingBox:!0},i);n.attributes.position.array=d,n.index&&(n.index.array=l.index),g.setBoundingBox&&(n.boundingBox=h.getBoundingBox(new e.Box3)),a(h)}};var s=n.index?n.index.array:null,f=n.attributes.position.array;if(f.isInterleavedBufferAttribute||s&&s.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");var l=[f];s&&l.push(s),o.postMessage({index:s,position:f,options:i},l.map(function(e){return e.buffer}))})}},{key:"terminate",value:function(){this.worker.terminate()}}]),n}();exports.GenerateMeshBVHWorker=a; },{"three":"dKqR","../MeshBVH.js":"nIyY","./generateAsync.worker.js":[["generateAsync.worker.13d14241.js","HHJX"],"HHJX"]}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iTHREE.js BVH Geometry Collect Triangles
- \ No newline at end of file +THREE.js BVH Geometry Collect Triangles
\ No newline at end of file diff --git a/example/bundle/characterMovement.725f956b.js b/example/bundle/characterMovement.725f956b.js index c87f5e675..54e8bebf3 100644 --- a/example/bundle/characterMovement.725f956b.js +++ b/example/bundle/characterMovement.725f956b.js @@ -12,7 +12,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var define; var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof e&&e.amd?e(n):t.Stats=n()}(this,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;to+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var l=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,s=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,s,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p,u,s,m),{dom:h,update:function(f,y){l=Math.min(l,f),i=Math.max(i,f),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(a(f)+" "+e+" ("+a(l)+"-"+a(i)+")",c,d),v.drawImage(h,p+o,u,s-o,m,p,u,s-o,m),v.fillRect(p+s-o,u,o,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p+s-o,u,o,a((1-f/y)*m))}}},e}); },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"tuIt":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CONTAINED=exports.INTERSECTED=exports.NOT_INTERSECTED=exports.SAH=exports.AVERAGE=exports.CENTER=void 0;var r=0;exports.CENTER=r;var E=1;exports.AVERAGE=E;var e=2;exports.SAH=e;var t=0;exports.NOT_INTERSECTED=t;var o=1;exports.INTERSECTED=o;var s=2;exports.CONTAINED=s; },{}],"qYFu":[function(require,module,exports) { @@ -20,15 +20,15 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iMath.abs(e*C.y*.25))?C.set(0,0,0):(i.normalize(),C.addScaledVector(i,-i.dot(C))),u.position.sub(x.target),x.target.copy(S.position),u.position.add(S.position),S.position.y<-25&&H()}function F(){h.update(),requestAnimationFrame(F);var e=Math.min(w.getDelta(),.1);if(b.firstPerson?(x.maxPolarAngle=Math.PI,x.minDistance=1e-4,x.maxDistance=1e-4):(x.maxPolarAngle=Math.PI/2,x.minDistance=1,x.maxDistance=20),g){g.visible=b.displayCollider,v.visible=b.displayBVH;for(var t=b.physicsSteps,a=0;aMath.abs(e*W.y*.25))?W.set(0,0,0):(i.normalize(),W.addScaledVector(i,-i.dot(W))),u.position.sub(x.target),x.target.copy(S.position),u.position.add(S.position),S.position.y<-25&&H()}function F(){f.update(),requestAnimationFrame(F);var e=Math.min(w.getDelta(),.1);if(b.firstPerson?(x.maxPolarAngle=Math.PI,x.minDistance=1e-4,x.maxDistance=1e-4):(x.maxPolarAngle=Math.PI/2,x.minDistance=1,x.maxDistance=20),g){g.visible=b.displayCollider,v.visible=b.displayBVH;for(var t=b.physicsSteps,a=0;ax;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; -},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { +},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Hh2M":[function(require,module,exports) { +"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; +},{"./_fails":"BXiR"}],"GyG6":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(2);r(r.P+r.F*!require("./_strict-method")([].filter,!0),"Array",{filter:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"Qppk":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); },{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); @@ -134,20 +138,20 @@ var t=require("./_has"),e=require("./_to-object"),o=require("./_shared-key")("IE "use strict";var e=require("./_library"),r=require("./_export"),t=require("./_redefine"),i=require("./_hide"),n=require("./_iterators"),u=require("./_iter-create"),o=require("./_set-to-string-tag"),s=require("./_object-gpo"),a=require("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",l="keys",q="values",y=function(){return this};module.exports=function(_,p,h,k,v,w,d){u(h,p,k);var x,b,g,j=function(e){if(!c&&e in I)return I[e];switch(e){case l:case q:return function(){return new h(this,e)}}return function(){return new h(this,e)}},m=p+" Iterator",A=v==q,F=!1,I=_.prototype,O=I[a]||I[f]||v&&I[v],P=O||j(v),z=v?A?j("entries"):P:void 0,B="Array"==p&&I.entries||O;if(B&&(g=s(B.call(new _)))!==Object.prototype&&g.next&&(o(g,m,!0),e||"function"==typeof g[a]||i(g,a,y)),A&&O&&O.name!==q&&(F=!0,P=function(){return O.call(this)}),e&&!d||!c&&!F&&I[a]||i(I,a,P),n[p]=P,n[m]=y,v)if(x={values:A?P:j(q),keys:w?P:j(l),entries:z},d)for(b in x)b in I||t(I,b,x[b]);else r(r.P+r.F*(c||F),p,x);return x}; },{"./_library":"H21C","./_export":"izCb","./_redefine":"PHot","./_hide":"NXbe","./_iterators":"JO4d","./_iter-create":"ebgP","./_set-to-string-tag":"rq3q","./_object-gpo":"q6yw","./_wks":"AIP1"}],"wVEN":[function(require,module,exports) { "use strict";var e=require("./_add-to-unscopables"),r=require("./_iter-step"),t=require("./_iterators"),i=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=i(e),this._i=0,this._k=r},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])},"values"),t.Arguments=t.Array,e("keys"),e("values"),e("entries"); -},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RB6b":[function(require,module,exports) { +},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RBsu":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(1);r(r.P+r.F*!require("./_strict-method")([].map,!0),"Array",{map:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"RB6b":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_create-property");r(r.S+r.F*require("./_fails")(function(){function r(){}return!(Array.of.call(r)instanceof r)}),"Array",{of:function(){for(var r=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>r;)e(n,r,arguments[r++]);return n.length=t,n}}); -},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"Hh2M":[function(require,module,exports) { -"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; -},{"./_fails":"BXiR"}],"nrVf":[function(require,module,exports) { +},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"btFn":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_html"),i=require("./_cof"),t=require("./_to-absolute-index"),u=require("./_to-length"),a=[].slice;r(r.P+r.F*require("./_fails")(function(){e&&a.call(e)}),"Array",{slice:function(r,e){var l=u(this.length),n=i(this);if(e=void 0===e?l:e,"Array"==n)return a.call(this,r,e);for(var s=t(r,l),c=t(e,l),h=u(c-s),o=new Array(h),f=0;f=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)} -},{}],"RDO9":[function(require,module,exports) { +},{"./es6.array.iterator":"wVEN","./_object-keys":"U9a7","./_redefine":"PHot","./_global":"qf4T","./_hide":"NXbe","./_iterators":"JO4d","./_wks":"AIP1"}],"RDO9":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=function(){var t=0,l=document.createElement("div");function n(e){return l.appendChild(e.dom),e}function a(e){for(var n=0;no+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:l,setMode:a}};exports.default=e,e.Panel=function(e,t,l){var n=1/0,a=0,i=Math.round,o=i(window.devicePixelRatio||1),r=80*o,f=48*o,d=3*o,c=2*o,p=3*o,s=15*o,u=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=l,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,d,c),v.fillRect(p,s,u,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p,s,u,m),{dom:h,update:function(f,x){n=Math.min(n,f),a=Math.max(a,f),v.fillStyle=l,v.globalAlpha=1,v.fillRect(0,0,r,s),v.fillStyle=t,v.fillText(i(f)+" "+e+" ("+i(n)+"-"+i(a)+")",d,c),v.drawImage(h,p+o,s,u-o,m,p,s,u-o,m),v.fillRect(p+u-o,s,o,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p+u-o,s,o,i((1-f/x)*m))}}}; },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"dKqR":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArrayCamera=ch,exports.AxisHelper=lx,exports.BinaryTextureLoader=dx,exports.Bone=Yh,exports.BoundingBoxHelper=cx,exports.BufferAttribute=bi,exports.BufferGeometry=ki,exports.Camera=gs,exports.CanvasRenderer=fx,exports.CompressedTextureLoader=md,exports.CubicInterpolant=Xp,exports.Curve=yd,exports.DataTextureLoader=xd,exports.DiscreteInterpolant=Zp,exports.DynamicBufferAttribute=Kg,exports.EdgesHelper=hx,exports.EventDispatcher=In,exports.FileLoader=pd,exports.Float16BufferAttribute=Ri,exports.Float32Attribute=ox,exports.Float32BufferAttribute=Ci,exports.Float64Attribute=ax,exports.Float64BufferAttribute=Pi,exports.GLBufferAttribute=xf,exports.ImageBitmapLoader=Sm,exports.ImmediateRenderObject=Lf,exports.InstancedBufferAttribute=vm,exports.InstancedBufferGeometry=xm,exports.InstancedInterleavedBuffer=gf,exports.InstancedMesh=nu,exports.Int16Attribute=nx,exports.Int16BufferAttribute=Ti,exports.Int32Attribute=ix,exports.Int32BufferAttribute=Ai,exports.Int8Attribute=$g,exports.Int8BufferAttribute=wi,exports.InterleavedBuffer=_h,exports.InterleavedBufferAttribute=wh,exports.Interpolant=qp,exports.JSONLoader=gx,exports.LensFlare=vx,exports.Line=cu,exports.LineSegments=pu,exports.LinearInterpolant=Yp,exports.Loader=hd,exports.LoadingManager=ld,exports.Material=hi,exports.Mesh=os,exports.MeshFaceMaterial=Vg,exports.MeshPhysicalMaterial=Op,exports.MeshStandardMaterial=Fp,exports.MultiMaterial=Wg,exports.Object3D=Xr,exports.ParametricGeometry=exports.ParametricBufferGeometry=wp,exports.Particle=qg,exports.ParticleBasicMaterial=Zg,exports.ParticleSystem=Xg,exports.ParticleSystemMaterial=Jg,exports.PerspectiveCamera=xs,exports.PointCloud=jg,exports.PointCloudMaterial=Yg,exports.Points=yu,exports.PropertyBinding=uf,exports.QuaternionLinearInterpolant=td,exports.Raycaster=vf,exports.ShaderMaterial=fs,exports.SkinnedMesh=Xh,exports.TextureLoader=vd,exports.Uint16Attribute=rx,exports.Uint16BufferAttribute=Ei,exports.Uint32Attribute=sx,exports.Uint32BufferAttribute=Li,exports.Uint8Attribute=tx,exports.Uint8BufferAttribute=Mi,exports.Uint8ClampedAttribute=ex,exports.Uint8ClampedBufferAttribute=Si,exports.Vertex=Qg,exports.WebGLRenderTargetCube=mx,exports.WebGLRenderer=fh,exports.WebGLUtils=lh,exports.WireframeHelper=ux,exports.XHRLoader=px,exports.FloatType=exports.FlatShading=exports.FaceColors=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTexture=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CanvasTexture=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.ObjectLoader=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MaterialLoader=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.ImageLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.FontLoader=exports.Font=exports.FogExp2=exports.Fog=void 0,exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.Path=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VertexColors=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.Texture=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=void 0;const t="126";exports.REVISION="126";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const r=0;exports.CullFaceNone=r;const i=1;exports.CullFaceBack=i;const s=2;exports.CullFaceFront=s;const o=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const l=1;exports.PCFShadowMap=l;const c=2;exports.PCFSoftShadowMap=c;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const m=1;exports.FlatShading=1;const f=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const I=206;exports.DstAlphaFactor=I;const B=207;exports.OneMinusDstAlphaFactor=B;const N=208;exports.DstColorFactor=N;const F=209;exports.OneMinusDstColorFactor=F;const O=210;exports.SrcAlphaSaturateFactor=O;const z=0;exports.NeverDepth=z;const G=1;exports.AlwaysDepth=G;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=et;const nt=301;exports.CubeReflectionMapping=nt;const rt=302;exports.CubeRefractionMapping=rt;const it=303;exports.EquirectangularReflectionMapping=it;const st=304;exports.EquirectangularRefractionMapping=st;const ot=306;exports.CubeUVReflectionMapping=ot;const at=307;exports.CubeUVRefractionMapping=at;const lt=1e3;exports.RepeatWrapping=lt;const ct=1001;exports.ClampToEdgeWrapping=ct;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const mt=1005;exports.NearestMipmapLinearFilter=mt;const ft=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const It=1021;exports.AlphaFormat=It;const Bt=1022;exports.RGBFormat=Bt;const Nt=1023;exports.RGBAFormat=Nt;const Ft=1024;exports.LuminanceFormat=Ft;const Ot=1025;exports.LuminanceAlphaFormat=Ot;const zt=Nt;exports.RGBEFormat=zt;const Gt=1026;exports.DepthFormat=Gt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const re=37496;exports.RGBA_ETC2_EAC_Format=re;const ie=37808;exports.RGBA_ASTC_4x4_Format=ie;const se=37809;exports.RGBA_ASTC_5x4_Format=se;const oe=37810;exports.RGBA_ASTC_5x5_Format=oe;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const le=37812;exports.RGBA_ASTC_6x6_Format=le;const ce=37813;exports.RGBA_ASTC_8x5_Format=ce;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const me=37818;exports.RGBA_ASTC_10x8_Format=me;const fe=37819;exports.RGBA_ASTC_10x10_Format=fe;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Ie=2200;exports.LoopOnce=Ie;const Be=2201;exports.LoopRepeat=Be;const Ne=2202;exports.LoopPingPong=Ne;const Fe=2300;exports.InterpolateDiscrete=Fe;const Oe=2301;exports.InterpolateLinear=Oe;const ze=2302;exports.InterpolateSmooth=ze;const Ge=2400;exports.ZeroCurvatureEnding=Ge;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const sn=1;exports.ObjectSpaceNormalMap=sn;const on=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const ln=7681;exports.ReplaceStencilOp=7681;const cn=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const mn=512;exports.NeverStencilFunc=512;const fn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function In(){}exports.GLSL3=Dn,Object.assign(In.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e>8&255]+Bn[t>>16&255]+Bn[t>>24&255]+"-"+Bn[255&e]+Bn[e>>8&255]+"-"+Bn[e>>16&15|64]+Bn[e>>24&255]+"-"+Bn[63&n|128]+Bn[n>>8&255]+"-"+Bn[n>>16&255]+Bn[n>>24&255]+Bn[255&r]+Bn[r>>8&255]+Bn[r>>16&255]+Bn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Fn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Fn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Nn=t%2147483647),((Nn=16807*Nn%2147483647)-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),h=o((e+r)/2),u=s((e-r)/2),p=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(i){case"XYX":t.set(a*h,l*u,l*p,a*c);break;case"YZY":t.set(l*p,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*p,a*h,a*c);break;case"XZX":t.set(a*h,l*m,l*d,a*c);break;case"YXY":t.set(l*d,a*h,l*m,a*c);break;case"ZYZ":t.set(l*m,l*d,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};exports.MathUtils=exports.Math=Fn;class On{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=On,On.prototype.isVector2=!0;class zn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],m=r[0],f=r[3],g=r[6],x=r[1],v=r[4],y=r[7],_=r[2],b=r[5],w=r[8];return i[0]=s*m+o*x+a*_,i[3]=s*f+o*v+a*b,i[6]=s*g+o*y+a*w,i[1]=l*m+c*x+h*_,i[4]=l*f+c*v+h*b,i[7]=l*g+c*y+h*w,i[2]=u*m+p*x+d*_,i[5]=u*f+p*v+d*b,i[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*i*c+n*o*a+r*i*l-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*i,p=l*i-s*a,d=e*h+n*u+r*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=h*m,t[1]=(r*l-c*n)*m,t[2]=(o*n-r*s)*m,t[3]=u*m,t[4]=(c*e-r*a)*m,t[5]=(r*i-o*e)*m,t[6]=p*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*i)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,s,o){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-r*l,r*a,-r*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],l=r[4],c=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*a,r[4]=-n*s+e*l,r[7]=-n*o+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;exports.Matrix3=zn,zn.prototype.isMatrix3=!0;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;class kn extends In{constructor(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=ct,r=ct,i=gt,s=yt,o=Nt,a=bt,l=1,c=Xe){super(),Object.defineProperty(this,"id",{value:Un++}),this.uuid=Fn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new On(0,0),this.repeat=new On(1,1),this.center=new On(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=Fn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t1)switch(this.wrapS){case lt:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case lt:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}exports.Texture=kn,kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=et,kn.prototype.isTexture=!0;class Wn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const s=t.elements,o=s[0],a=s[4],l=s[8],c=s[1],h=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(h+1)/2,f=(m+1)/2,g=(a+c)/4,x=(l+p)/4,v=(u+d)/4;return t>s&&t>f?t<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(t)),i=x/n):s>f?s<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(s)),i=v/r):f<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(f)),r=v/i),this.set(n,r,i,e),this}let f=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-a)*(c-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(l-p)/f,this.z=(c-a)/f,this.w=Math.acos((o+h+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn,Wn.prototype.isVector4=!0;class jn extends In{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn,jn.prototype.isWebGLRenderTarget=!0;class qn extends jn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn,qn.prototype.isWebGLMultisampleRenderTarget=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[s+0],p=i[s+1],d=i[s+2],m=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(h!==m||a!==u||l!==p||c!==d){let t=1-o;const e=a*u+l*p+c*d+h*m,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+u*i,l=l*t+p*i,c=c*t+d*i,h=h*t+m*i,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[s],u=i[s+1],p=i[s+2],d=i[s+3];return t[e]=o*d+c*h+a*p-l*u,t[e+1]=a*d+c*u+l*h-o*p,t[e+2]=l*d+c*p+o*u-a*h,t[e+3]=c*d-o*h-a*u-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=a(n/2),p=a(r/2),d=a(i/2);switch(s){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(i-l)*t,this._z=(s-r)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(i-l)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-r)/t,this._x=(i+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+r*l-i*a,this._y=r*c+s*a+i*o-n*l,this._z=i*c+s*l+n*a-r*o,this._w=s*c-n*o-r*a-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn,Xn.prototype.isQuaternion=!0;class Yn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*r-o*n,c=a*n+o*e-i*r,h=a*r+i*n-s*e,u=-i*e-s*n-o*r;return this.x=l*a+u*-i+c*-o-h*-s,this.y=c*a+u*-s+h*-i-l*-o,this.z=h*a+u*-o+l*-s-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn,Yn.prototype.isVector3=!0;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t=new Yn(1/0,1/0,1/0),e=new Yn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$n),$n.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ar),lr.subVectors(this.max,ar),er.subVectors(t.a,ar),nr.subVectors(t.b,ar),rr.subVectors(t.c,ar),ir.subVectors(nr,er),sr.subVectors(rr,nr),or.subVectors(er,rr);let e=[0,-ir.z,ir.y,0,-sr.z,sr.y,0,-or.z,or.y,ir.z,0,-ir.x,sr.z,0,-sr.x,or.z,0,-or.x,-ir.y,ir.x,0,-sr.y,sr.x,0,-or.y,or.x,0];return!!ur(e,er,nr,rr,lr)&&(!!ur(e=[1,0,0,0,1,0,0,0,1],er,nr,rr,lr)&&(cr.crossVectors(ir,sr),ur(e=[cr.x,cr.y,cr.z],er,nr,rr,lr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $n.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize($n).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box3=Qn,Qn.prototype.isBox3=!0;const Kn=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],$n=new Yn,tr=new Qn,er=new Yn,nr=new Yn,rr=new Yn,ir=new Yn,sr=new Yn,or=new Yn,ar=new Yn,lr=new Yn,cr=new Yn,hr=new Yn;function ur(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){hr.fromArray(t,s);const o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),a=e.dot(hr),l=n.dot(hr),c=r.dot(hr);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const pr=new Qn;class dr{constructor(t=new Yn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}exports.Sphere=dr;const mr=new Yn,fr=new Yn,gr=new Yn,xr=new Yn,vr=new Yn,yr=new Yn,_r=new Yn;class br{constructor(t=new Yn,e=new Yn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mr.copy(this.direction).multiplyScalar(e).add(this.origin),mr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){fr.copy(t).add(e).multiplyScalar(.5),gr.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(fr);const i=.5*t.distanceTo(e),s=-this.direction.dot(gr),o=xr.dot(this.direction),a=-xr.dot(gr),l=xr.lengthSq(),c=Math.abs(1-s*s);let h,u,p,d;if(c>0)if(u=s*o-a,d=i*c,(h=s*a-o)>=0)if(u>=-d)if(u<=d){const t=1/c;p=(h*=t)*(h+s*(u*=t)+2*o)+u*(s*h+u+2*a)+l}else u=i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u=-i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u<=-d?p=-(h=Math.max(0,-(-s*i+o)))*h+(u=h>0?-i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l:u<=d?(h=0,p=(u=Math.min(Math.max(-i,-a),i))*(u+2*a)+l):p=-(h=Math.max(0,-(s*i+o)))*h+(u=h>0?i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l;else u=s>0?-i:i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(gr).multiplyScalar(u).add(fr),p}intersectSphere(t,e){mr.subVectors(t.center,this.origin);const n=mr.dot(this.direction),r=mr.dot(mr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,r=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,r=(t.min.x-u.x)*l),c>=0?(i=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(i=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||i>r?null:((i>n||n!=n)&&(n=i),(s=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>r?null:((o>n||n!=n)&&(n=o),(a=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mr)}intersectTriangle(t,e,n,r,i){vr.subVectors(e,t),yr.subVectors(n,t),_r.crossVectors(vr,yr);let s,o=this.direction.dot(_r);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}xr.subVectors(this.origin,t);const a=s*this.direction.dot(yr.crossVectors(xr,yr));if(a<0)return null;const l=s*this.direction.dot(vr.cross(xr));if(l<0)return null;if(a+l>o)return null;const c=-s*xr.dot(_r);return c<0?null:this.at(c/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}exports.Ray=br;class wr{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l,c,h,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wr).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Mr.setFromMatrixColumn(t,0).length(),i=1/Mr.setFromMatrixColumn(t,1).length(),s=1/Mr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-o*a,e[2]=i-t*l,e[6]=r+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t-i*o,e[4]=-s*h,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*c,e[9]=i-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=a*h,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=i-t*h,e[8]=r*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+r,e[10]=t-i*h}else if("XZY"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+i,e[5]=s*c,e[9]=n*h-r,e[2]=r*h-n,e[6]=o*c,e[10]=i*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tr,t,Er)}lookAt(t,e,n){const r=this.elements;return Rr.subVectors(t,e),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ar.crossVectors(n,Rr),0===Ar.lengthSq()&&(1===Math.abs(n.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ar.crossVectors(n,Rr)),Ar.normalize(),Lr.crossVectors(Rr,Ar),r[0]=Ar.x,r[4]=Lr.x,r[8]=Rr.x,r[1]=Ar.y,r[5]=Lr.y,r[9]=Rr.y,r[2]=Ar.z,r[6]=Lr.z,r[10]=Rr.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],m=n[6],f=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],B=r[7],N=r[11],F=r[15];return i[0]=s*b+o*T+a*R+l*I,i[4]=s*w+o*E+a*C+l*B,i[8]=s*M+o*A+a*P+l*N,i[12]=s*S+o*L+a*D+l*F,i[1]=c*b+h*T+u*R+p*I,i[5]=c*w+h*E+u*C+p*B,i[9]=c*M+h*A+u*P+p*N,i[13]=c*S+h*L+u*D+p*F,i[2]=d*b+m*T+f*R+g*I,i[6]=d*w+m*E+f*C+g*B,i[10]=d*M+m*A+f*P+g*N,i[14]=d*S+m*L+f*D+g*F,i[3]=x*b+v*T+y*R+_*I,i[7]=x*w+v*E+y*C+_*B,i[11]=x*M+v*A+y*P+_*N,i[15]=x*S+v*L+y*D+_*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+i*a*h-r*l*h-i*o*u+n*l*u+r*o*p-n*a*p)+t[7]*(+e*a*p-e*l*u+i*s*u-r*s*p+r*l*c-i*a*c)+t[11]*(+e*l*h-e*o*p-i*s*h+n*s*p+i*o*c-n*l*c)+t[15]*(-r*o*c-e*a*h+e*o*u+r*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],x=h*f*l-m*u*l+m*a*p-o*f*p-h*a*g+o*u*g,v=d*u*l-c*f*l-d*a*p+s*f*p+c*a*g-s*u*g,y=c*m*l-d*h*l+d*o*p-s*m*p-c*o*g+s*h*g,_=d*h*a-c*m*a-d*o*u+s*m*u+c*o*f-s*h*f,b=e*x+n*v+r*y+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=x*w,t[1]=(m*u*i-h*f*i-m*r*p+n*f*p+h*r*g-n*u*g)*w,t[2]=(o*f*i-m*a*i+m*r*l-n*f*l-o*r*g+n*a*g)*w,t[3]=(h*a*i-o*u*i-h*r*l+n*u*l+o*r*p-n*a*p)*w,t[4]=v*w,t[5]=(c*f*i-d*u*i+d*r*p-e*f*p-c*r*g+e*u*g)*w,t[6]=(d*a*i-s*f*i-d*r*l+e*f*l+s*r*g-e*a*g)*w,t[7]=(s*u*i-c*a*i+c*r*l-e*u*l-s*r*p+e*a*p)*w,t[8]=y*w,t[9]=(d*h*i-c*m*i-d*n*p+e*m*p+c*n*g-e*h*g)*w,t[10]=(s*m*i-d*o*i+d*n*l-e*m*l-s*n*g+e*o*g)*w,t[11]=(c*o*i-s*h*i-c*n*l+e*h*l+s*n*p-e*o*p)*w,t[12]=_*w,t[13]=(c*m*r-d*h*r+d*n*u-e*m*u-c*n*f+e*h*f)*w,t[14]=(d*o*r-s*m*r-d*n*a+e*m*a+s*n*f-e*o*f)*w,t[15]=(s*h*r-c*o*r+c*n*a-e*h*a-s*n*u+e*o*u)*w,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,l=i*s,c=i*o;return this.set(l*s+n,l*o-r*a,l*a+r*o,0,l*o+r*a,c*o+n,c*a-r*s,0,l*a-r*o,c*a+r*s,i*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,l=i+i,c=s+s,h=o+o,u=i*l,p=i*c,d=i*h,m=s*c,f=s*h,g=o*h,x=a*l,v=a*c,y=a*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(m+g))*_,r[1]=(p+y)*_,r[2]=(d-v)*_,r[3]=0,r[4]=(p-y)*b,r[5]=(1-(u+g))*b,r[6]=(f+x)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(f-x)*w,r[10]=(1-(u+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Mr.set(r[0],r[1],r[2]).length();const s=Mr.set(r[4],r[5],r[6]).length(),o=Mr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Sr.copy(this);const a=1/i,l=1/s,c=1/o;return Sr.elements[0]*=a,Sr.elements[1]*=a,Sr.elements[2]*=a,Sr.elements[4]*=l,Sr.elements[5]*=l,Sr.elements[6]*=l,Sr.elements[8]*=c,Sr.elements[9]*=c,Sr.elements[10]*=c,e.setFromRotationMatrix(Sr),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),h=(n+r)/(n-r),u=-(s+i)/(s-i),p=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),l=1/(n-r),c=1/(s-i),h=(e+t)*a,u=(n+r)*l,p=(s+i)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wr,wr.prototype.isMatrix4=!0;const Mr=new Yn,Sr=new wr,Tr=new Yn(0,0,0),Er=new Yn(1,1,1),Ar=new Yn,Lr=new Yn,Rr=new Yn,Cr=new wr,Pr=new Xn;class Dr{constructor(t=0,e=0,n=0,r=Dr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Fn.clamp,i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Pr.setFromEuler(this),this.setFromQuaternion(Pr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Dr,Dr.prototype.isEuler=!0,Dr.DefaultOrder="XYZ",Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ir{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){r.children=[];for(let e=0;e0){r.animations=[];for(let e=0;e0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function s(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n1?void 0:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Jr.getNormalMatrix(t),r=this.coplanarPoint(Yr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}exports.Plane=Qr,Qr.prototype.isPlane=!0;const Kr=new Yn,$r=new Yn,ti=new Yn,ei=new Yn,ni=new Yn,ri=new Yn,ii=new Yn,si=new Yn,oi=new Yn,ai=new Yn;class li{constructor(t=new Yn,e=new Yn,n=new Yn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Yn),r.subVectors(n,e),Kr.subVectors(t,e),r.cross(Kr);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Kr.subVectors(r,e),$r.subVectors(n,e),ti.subVectors(t,e);const s=Kr.dot(Kr),o=Kr.dot($r),a=Kr.dot(ti),l=$r.dot($r),c=$r.dot(ti),h=s*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Yn),0===h)return i.set(-2,-1,-1);const u=1/h,p=(l*a-o*c)*u,d=(s*c-o*a)*u;return i.set(1-p-d,d,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ei),a.set(0,0),a.addScaledVector(i,ei.x),a.addScaledVector(s,ei.y),a.addScaledVector(o,ei.z),a}static isFrontFacing(t,e,n,r){return Kr.subVectors(n,e),$r.subVectors(t,e),Kr.cross($r).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Kr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Kr.cross($r).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return li.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qr),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return li.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return li.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return li.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return li.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,r=this.b,i=this.c;let s,o;ni.subVectors(r,n),ri.subVectors(i,n),si.subVectors(t,n);const a=ni.dot(si),l=ri.dot(si);if(a<=0&&l<=0)return e.copy(n);oi.subVectors(t,r);const c=ni.dot(oi),h=ri.dot(oi);if(c>=0&&h<=c)return e.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(ni,s);ai.subVectors(t,i);const p=ni.dot(ai),d=ri.dot(ai);if(d>=0&&p<=d)return e.copy(i);const m=p*l-a*d;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),e.copy(n).addScaledVector(ri,o);const f=c*d-p*h;if(f<=0&&h-c>=0&&p-d>=0)return ii.subVectors(i,r),o=(h-c)/(h-c+(p-d)),e.copy(r).addScaledVector(ii,o);const g=1/(f+m+u);return s=m*g,o=u*g,e.copy(n).addScaledVector(ni,s).addScaledVector(ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=li;let ci=0;function hi(){Object.defineProperty(this,"id",{value:ci++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}hi.prototype=Object.assign(Object.create(In.prototype),{constructor:hi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(hi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},di={h:0,s:0,l:0};function mi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function fi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=mi(i,r,t+1/3),this.g=mi(i,r,t),this.b=mi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ui[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}copyLinearToSRGB(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const l=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=l<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(ne&&(e=t[n]);return e}Object.defineProperty(bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r65535?Li:Ei)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new zn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fi.makeRotationX(t),this.applyMatrix4(Fi),this},rotateY:function(t){return Fi.makeRotationY(t),this.applyMatrix4(Fi),this},rotateZ:function(t){return Fi.makeRotationZ(t),this.applyMatrix4(Fi),this},translate:function(t,e,n){return Fi.makeTranslation(t,e,n),this.applyMatrix4(Fi),this},scale:function(t,e,n){return Fi.makeScale(t,e,n),this.applyMatrix4(Fi),this},lookAt:function(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],r=e.toJSON(t.data);""!==e.name&&(r.name=e.name),t.data.attributes[a]=r}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ki).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const l in r){const t=r[l];this.setAttribute(l,t.clone(e))}const i=t.morphAttributes;for(const l in i){const t=[],n=i[l];for(let r=0,i=n.length;rn.far?null:{distance:c,point:ss.clone(),object:t}}function ls(t,e,n,r,i,s,o,a,l,c,h,u){qi.fromBufferAttribute(i,c),Xi.fromBufferAttribute(i,h),Yi.fromBufferAttribute(i,u);const p=t.morphTargetInfluences;if(e.morphTargets&&s&&p){Ki.set(0,0,0),$i.set(0,0,0),ts.set(0,0,0);for(let t=0,e=s.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(i),!1===t.ray.intersectsSphere(ji))return;if(Vi.copy(i).invert(),Wi.copy(t.ray).applyMatrix4(Vi),null!==n.boundingBox&&!1===Wi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;n0?1:-1,c.push(A.x,A.y,A.z),h.push(a/f),h.push(1-o/g),T+=1}}for(let o=0;o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},gs.prototype=Object.assign(Object.create(Xr.prototype),{constructor:gs,isCamera:!0,copy:function(t,e){return Xr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),xs.prototype=Object.assign(Object.create(gs.prototype),{constructor:xs,isPerspectiveCamera:!0,copy:function(t,e){return gs.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xr.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const vs=90,ys=1;class _s extends Xr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new xs(vs,ys,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(1,0,0)),this.add(r);const i=new xs(vs,ys,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(-1,0,0)),this.add(i);const s=new xs(vs,ys,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Yn(0,1,0)),this.add(s);const o=new xs(vs,ys,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Yn(0,-1,0)),this.add(o);const a=new xs(vs,ys,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const l=new xs(vs,ys,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Yn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}exports.CubeCamera=_s;class bs extends kn{constructor(t,e,n,r,i,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:nt,n,r,i,s,o=void 0!==o?o:Bt,a,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}exports.CubeTexture=bs,bs.prototype.isCubeTexture=!0;class ws extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bs(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:gt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Nt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new cs(5,5,5),i=new fs({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});i.uniforms.tEquirect.value=e;const s=new os(r,i),o=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new _s(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}exports.WebGLCubeRenderTarget=ws,ws.prototype.isWebGLCubeRenderTarget=!0;class Ms extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ut,this.minFilter=void 0!==c?c:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}exports.DataTexture=Ms,Ms.prototype.isDataTexture=!0;const Ss=new dr,Ts=new Yn;class Es{constructor(t=new Qr,e=new Qr,n=new Qr,r=new Qr,i=new Qr,s=new Qr){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],m=n[11],f=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(o-r,h-a,m-u,v-f).normalize(),e[1].setComponents(o+r,h+a,m+u,v+f).normalize(),e[2].setComponents(o+i,h+l,m+p,v+g).normalize(),e[3].setComponents(o-i,h-l,m-p,v-g).normalize(),e[4].setComponents(o-s,h-c,m-d,v-x).normalize(),e[5].setComponents(o+s,h+c,m+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version=0){const s=l[e];if(void 0!==s){const e=s.normalized,i=s.itemSize,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(f(r,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r+0,1),f(r+1,1),f(r+2,1),f(r+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r+0,4,o,!1,64,0),t.vertexAttribPointer(r+1,4,o,!1,64,16),t.vertexAttribPointer(r+2,4,o,!1,64,32),t.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)u(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function rl(t,e,n,r){const i=r.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,r){t.drawArrays(s,e,r),n.update(r,s,1)},this.renderInstances=function(r,o,a){if(0===a)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,r,o,a),n.update(o,s,a)}}function il(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=s||e.has("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:s?t.getParameter(36183):0}}function sl(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Qr,a=new zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==i||null===c){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length0){const o=t.getRenderTarget(),a=new ws(s.height/2);return a.fromEquirectangularTexture(t,i),e.set(i,a),t.setRenderTarget(o),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function al(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ll(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e65535?Li:Ei)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===i[e.id]?e:(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n0)return t;const i=e*n;let s=bl[i];if(void 0===s&&(s=new Float32Array(i),bl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function Al(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n/gm;function Rc(t){return t.replace(Lc,Cc)}function Cc(t,e){const n=Ka[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Pc=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Dc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ic(t){return t.replace(Dc,Nc).replace(Pc,Bc)}function Bc(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nc(t,e,n,r)}function Nc(t,e,n,r){let i="";for(let s=parseInt(e);s0?t.gammaFactor:1,d=n.isWebGL2?"":wc(n),m=Mc(s),f=i.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[m].filter(Tc).join("\n")).length>0&&(g+="\n"),(x=[d,m].filter(Tc).join("\n")).length>0&&(x+="\n")):(g=[Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Tc).join("\n"),x=[d,Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?Ka.tonemapping_pars_fragment:"",n.toneMapping!==Z?bc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ka.encodings_pars_fragment,n.map?yc("mapTexelToLinear",n.mapEncoding):"",n.matcap?yc("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?yc("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?yc("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?yc("lightMapTexelToLinear",n.lightMapEncoding):"",_c("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Tc).join("\n")),o=Ac(o=Ec(o=Rc(o),n),n),a=Ac(a=Ec(a=Rc(a),n),n),o=Ic(o),a=Ic(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const y=v+x+a,_=mc(i,35633,v+g+o),b=mc(i,35632,y);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(f).trim(),e=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const e=vc(i,_,"vertex"),n=vc(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new dc(i,f)),w},this.getAttributes=function(){return void 0===M&&(M=Sc(i,f)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=fc++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}function kc(t,e,n,r,i,s){const o=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let m=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(i,o,g,v,y){const _=v.fog,b=i.isMeshStandardMaterial?v.environment:null,w=e.get(i.envMap||b),M=f[i.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===d,flipSided:i.side===p,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&r.sort(t||Wc),i.length>1&&i.sort(e||jc)}}}function Xc(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new qc(t),e.set(n,[i])):r>=e.get(n).length?(i=new qc(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new xi};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Zc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Jc=0;function Qc(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Kc(t,e){const n=new Yc,r=Zc(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)i.probe.push(new Yn);const s=new Yn,o=new wr,a=new wr;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,h=0,u=0,p=0,d=0,m=0,f=0,g=0;s.sort(Qc);for(let t=0,e=s.length;t0&&(e.isWebGL2?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=$a.LTC_HALF_1,i.rectAreaLTC2=$a.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=a,i.ambient[2]=l;const x=i.hash;x.directionalLength===c&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===m&&x.numPointShadows===f&&x.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=p,i.point.length=h,i.hemi.length=d,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=f,i.spotShadowMatrix.length=g,x.directionalLength=c,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=m,x.numPointShadows=f,x.numSpotShadows=g,i.version=Jc++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p=n.get(r).length?(s=new $c(t,e),n.get(r).push(s)):s=n.get(r)[i],s},dispose:function(){n=new WeakMap}}}class eh extends hi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}exports.MeshDepthMaterial=eh,eh.prototype.isMeshDepthMaterial=!0;class nh extends hi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}exports.MeshDistanceMaterial=nh,nh.prototype.isMeshDistanceMaterial=!0;var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ih="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let r=new Es;const i=new On,s=new On,o=new Wn,a=[],c=[],m={},f={0:p,1:u,2:d},x=new fs({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new On},radius:{value:4}},vertexShader:ih,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new ki;y.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new os(y,x),b=this;function w(n,r){const i=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,_,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=a[r];return void 0===i&&(i=new eh({depthPacking:nn,morphTargets:t,skinning:e}),a[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=c[r];return void 0===i&&(i=new nh({morphTargets:t,skinning:e}),c[r]=i),i}function T(e,n,r,i,s,o,a){let l=null,c=M,u=e.customDepthMaterial;if(!0===i.isPointLight&&(c=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(t,i,!0===e.isInstancedMesh)}else l=u;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=a===h?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=s,l.farDistance=o),l}function E(n,i,s,o,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;ln||i.y>n)&&(i.x>n&&(s.x=Math.floor(n/p.x),i.x=s.x*p.x,u.mapSize.x=s.x),i.y>n&&(s.y=Math.floor(n/p.y),i.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new jn(i.x,i.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(ot=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),st=ot>=2);let lt=null,ct={};const ht=new Wn,ut=new Wn;function pt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;or||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Fn.floorPowerOfTwo:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===d&&(d=f(s,o));const a=n?f(s,o):d;return a.width=s,a.height=o,a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,i,s){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,s))}function _(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function b(t){return t===ut||t===pt||t===mt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),s=r.get(n);if(!e)return;void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function E(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;C(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=o||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const u=h[0],p=x(u)||a,d=s.convert(r.format),m=s.convert(r.type),f=_(r.internalFormat,d,m);let b;if(R(34067,r,p),o){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),o.memory.textures++)}function P(e,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==ut&&t.minFilter!==gt)}(r)&&!1===x(r.image),c=g(r.image,l,!1,h),u=x(c)||a,p=s.convert(r.format);let d,m=s.convert(r.type),f=_(r.internalFormat,p,m);R(o,r,u);const b=r.mipmaps;if(r.isDepthTexture)f=6402,a?f=r.type===At?36012:r.type===Et?33190:r.type===Dt?35056:33189:r.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===f&&r.type!==St&&r.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=St,m=s.convert(r.type)),r.format===Ht&&6402===f&&(f=34041,r.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Dt,m=s.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t0&&u){for(let t=0,e=b.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,p=i.isDataTexture3D||i.isDataTexture2DArray,d=x(e)||a;if(!a||i.format!==Bt||i.type!==At&&i.type!==Lt||(i.format=Nt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(i.format),r=s.convert(i.type),o=_(i.internalFormat,n,r),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),I(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),R(34067,i,d);for(let t=0;t<6;t++)D(l.__webglFramebuffer[t],e,36064,34069+t);v(i,d)&&y(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;p&&(a?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),R(t,i,d),D(l.__webglFramebuffer,e,36064,t),v(i,d)&&y(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const i=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;n.bindTexture(i,s),y(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===It)return 6406;if(t===Bt)return 6407;if(t===Nt)return 6408;if(t===Ft)return 6409;if(t===Ot)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===re)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===re)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ie||t===se||t===oe||t===ae||t===le||t===ce||t===he||t===ue||t===pe||t===de||t===me||t===fe||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(t=[]){xs.call(this),this.cameras=t}ch.prototype=Object.assign(Object.create(xs.prototype),{constructor:ch,isArrayCamera:!0});class hh extends Xr{constructor(){super(),this.type="Group"}}function uh(){this._targetRay=null,this._grip=null,this._hand=null}function ph(t,e){const n=this;let r=null,i=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new xs;h.layers.enable(1),h.viewport=new Wn;const u=new xs;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new ch;d.layers.enable(1),d.layers.enable(2);let m=null,f=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){c.forEach(function(t,e){t.disconnect(e)}),c.clear(),m=null,f=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=r.inputSources;for(let n=0;n0&&wt(s,t,e),o.length>0&&wt(o,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==_&&(X.updateRenderTargetMipmap(_),X.updateMultisampleRenderTarget(_)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,d.pop(),u=d.length>0?d[d.length-1]:null},this.setFramebuffer=function(t){x!==t&&null===_&&ht.bindFramebuffer(36160,t),x=t},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=x,i=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=o[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),E=t.scissorTest}else S.copy(D).multiplyScalar(R).floor(),T.copy(I).multiplyScalar(R).floor(),E=B;if(b!==r&&(ht.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(T),W.setScissorTest(E),i){const r=q.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(s){const r=q.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==b&&(ht.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Nt&<.convert(l)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===Lt&&(k.has("EXT_color_buffer_half_float")||V.isWebGL2&&k.has("EXT_color_buffer_float"));if(!(c===bt||lt.convert(c)===ht.getParameter(35738)||c===At&&(V.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ht.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),o=lt.convert(e.format);X.setTexture2D(e,0),ht.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=lt.convert(n.format),a=lt.convert(n.type);X.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let h;if(r.isDataTexture3D)X.setTexture3D(r,0),h=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),h=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const u=ht.getParameter(3314),p=ht.getParameter(32878),d=ht.getParameter(3316),m=ht.getParameter(3315),g=ht.getParameter(32877);ht.pixelStorei(3314,s),ht.pixelStorei(32878,o),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),ht.texSubImage3D(h,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,a),ht.pixelStorei(3314,u),ht.pixelStorei(32878,p),ht.pixelStorei(3316,d),ht.pixelStorei(3315,m),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(h),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}exports.Group=hh,hh.prototype.isGroup=!0,Object.assign(uh.prototype,{constructor:uh,getHandSpace:function(){return null===this._hand&&(this._hand=new hh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new hh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new hh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new hh;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const r=l.joints[s.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),this}}),Object.assign(ph.prototype,In.prototype);class gh extends fh{}exports.WebGL1Renderer=gh,gh.prototype.isWebGL1Renderer=!0;class xh{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new xh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=xh,xh.prototype.isFogExp2=!0;class vh{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new vh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=vh,vh.prototype.isFog=!0;class yh extends Xr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function _h(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}exports.Scene=yh,yh.prototype.isScene=!0,Object.defineProperty(_h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_h.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;rt.far||e.push({distance:a,point:Th.clone(),uv:li.getUV(Th,Ph,Dh,Ih,Bh,Nh,Fh,new On),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function zh(t,e,n,r,i,s){Lh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Rh.x=s*Lh.x-i*Lh.y,Rh.y=i*Lh.x+s*Lh.y):Rh.copy(Lh),t.copy(e),t.x+=Rh.x,t.y+=Rh.y,t.applyMatrix4(Ch)}exports.Sprite=Oh,Oh.prototype.isSprite=!0;const Gh=new Yn,Hh=new Yn;class Uh extends Xr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n0){let n,r;for(n=1,r=e.length;n0){Gh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Gh);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Gh.setFromMatrixPosition(t.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=Gh.distanceTo(Hh)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;ro)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);pt.far||e.push({distance:p,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,s=i.count-1;no)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const hu=new Yn,uu=new Yn;function pu(t,e){cu.call(this,t,e),this.type="LineSegments"}pu.prototype=Object.assign(Object.create(cu.prototype),{constructor:pu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;ti.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}yu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:yu,isPoints:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xu.copy(n.boundingSphere),xu.applyMatrix4(r),xu.radius+=i,!1===t.ray.intersectsSphere(xu))return;fu.copy(r).invert(),gu.copy(t.ray).applyMatrix4(fu);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class bu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.format=void 0!==o?o:Bt,this.minFilter=void 0!==s?s:gt,this.magFilter=void 0!==i?i:gt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}exports.VideoTexture=bu,bu.prototype.isVideoTexture=!0;class wu extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}exports.CompressedTexture=wu,wu.prototype.isCompressedTexture=!0;class Mu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.needsUpdate=!0}}exports.CanvasTexture=Mu,Mu.prototype.isCanvasTexture=!0;class Su extends kn{constructor(t,e,n,r,i,s,o,a,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=St),void 0===n&&c===Ht&&(n=Dt),super(null,r,i,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}}exports.DepthTexture=Su,Su.prototype.isDepthTexture=!0;class Tu extends ki{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],l=new Yn,c=new On;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const i=n+h/e*r;l.x=t*Math.cos(i),l.y=t*Math.sin(i),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[u]/t+1)/2,c.y=(s[u+1]/t+1)/2,a.push(c.x,c.y)}for(let h=1;h<=e;h++)i.push(h,h+1,0);this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("normal",new Ci(o,3)),this.setAttribute("uv",new Ci(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Tu;class Eu extends ki{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],h=[],u=[],p=[];let d=0;const m=[],f=n/2;let g=0;function x(n){const i=d,s=new On,m=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=r;t++)h.push(0,f*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=r;t++){const e=t/r*a+o,n=Math.cos(e),i=Math.sin(e);m.x=v*i,m.y=f*y,m.z=v*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*i*y+.5,p.push(s.x,s.y),d++}for(let t=0;t0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Eu;class Au extends Eu{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}}exports.ConeGeometry=exports.ConeBufferGeometry=Au;class Lu extends ki{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),l=i-o;for(let t=0;t<=l;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/l)}for(let o=0;o.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(i.slice(),3)),this.setAttribute("uv",new Ci(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Lu;class Ru extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Ru;const Cu=new Yn,Pu=new Yn,Du=new Yn,Iu=new li;class Bu extends ki{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Fn.DEG2RAD*e),i=t.getIndex(),s=t.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let p=0;p80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),p>h&&(h=p);d=0!==(d=Math.max(c-a,h-l))?1/d:0}return zu(s,o,n,a,l,d),o}};function Fu(t,e,n,r,i){let s,o;if(i===pp(t,e,n,r)>0)for(s=e;s=e;s-=r)o=cp(s,t[s],t[s+1],o);return o&&ep(o,o.next)&&(hp(o),o=o.next),o}function Ou(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!ep(r,r.next)&&0!==tp(r.prev,r,r.next))r=r.next;else{if(hp(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zu(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yu(t,r,i,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hu(t,r,i,s):Gu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),hp(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?zu(t=Uu(Ou(t),e,n),e,n,r,i,s,2):2===o&&ku(t,e,n,r,i,s):zu(Ou(t),e,n,r,i,s,1);break}}function Gu(t){const e=t.prev,n=t,r=t.next;if(tp(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ku(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&tp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Hu(t,e,n,r){const i=t.prev,s=t,o=t.next;if(tp(i,s,o)>=0)return!1;const a=i.xs.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,h=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=Ju(a,l,e,n,r),p=Ju(c,h,e,n,r);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Uu(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!ep(i,s)&&np(i,r,r.next,s)&&op(i,s)&&op(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),hp(r),hp(r.next),r=t=s),r=r.next}while(r!==t);return Ou(r)}function ku(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&$u(o,t)){let a=lp(o,t);return o=Ou(o,o.next),a=Ou(a,a.next),zu(o,e,n,r,i,s),void zu(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function Vu(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&r!==n.x&&Ku(is.x||n.x===s.x&&Xu(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}function Xu(t,e){return tp(t.prev,t,e.prev)<0&&tp(e.next,t,t.next)<0}function Yu(t,e,n,r){let i=t;do{null===i.z&&(i.z=Ju(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zu(i)}function Zu(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function Ju(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Qu(t){let e=t,n=t;do{(e.x=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function $u(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(op(t,e)&&op(e,t)&&ap(t,e)&&(tp(t.prev,t,e.prev)||tp(t,e.prev,e))||ep(t,e)&&tp(t.prev,t,t.next)>0&&tp(e.prev,e,e.next)>0)}function tp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ep(t,e){return t.x===e.x&&t.y===e.y}function np(t,e,n,r){const i=ip(tp(t,e,n)),s=ip(tp(t,e,r)),o=ip(tp(n,r,t)),a=ip(tp(n,r,e));return i!==s&&o!==a||(!(0!==i||!rp(t,n,e))||(!(0!==s||!rp(t,r,e))||(!(0!==o||!rp(n,t,r))||!(0!==a||!rp(n,e,r)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ip(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&np(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function op(t,e){return tp(t.prev,t,t.next)<0?tp(t,e,t.next)>=0&&tp(t,t.prev,e)>=0:tp(t,e,t.prev)<0||tp(t,t.next,e)<0}function ap(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function lp(t,e){const n=new up(t.i,t.x,t.y),r=new up(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cp(t,e,n,r){const i=new up(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function hp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function up(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pp(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function fp(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(l*l+c*c),d=e.x-a/u,m=e.y+o/u,f=((n.x-c/p-d)*c-(n.y+l/p-m)*l)/(o*c-a*l),g=(r=d+o*f-t.x)*r+(i=m+a*f-t.y)*i;if(g<=2)return new On(r,i);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(h)):(r=o,i=a,s=Math.sqrt(h/2))}return new On(r/s,i/s)}const P=[];for(let e=0,n=E.length,r=n-1,i=e+1;e=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*d;t=0?(t(p-1e-5,r,c),h.subVectors(l,c)):(t(p+1e-5,r,c),h.subVectors(c,l)),r-1e-5>=0?(t(p,r-1e-5,c),u.subVectors(l,c)):(t(p,r+1e-5,c),u.subVectors(c,l)),a.crossVectors(h,u).normalize(),s.push(a.x,a.y,a.z),o.push(p,r)}}for(let d=0;d0)&&p.push(e,r,o),(g!==n-1||a=r)){a.push(t.times[s]);for(let n=0;ns.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=e.times[u]){const t=u*l+a,n=t+l-a;p=jp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=l-a;t.evaluate(s),p=jp.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=i.times.length;for(let t=0;t=i)break t;{const o=e[1];t=(i=e[--n-1]))break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==i||s!==r){i>=s&&(i=(s=Math.max(s,1))-1);const t=this.getValueSize();this.times=jp.arraySlice(n,i,s),this.values=jp.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&jp.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=jp.arraySlice(this.times),e=jp.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===ze,i=t.length-1;let s=1;for(let o=1;o0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=jp.arraySlice(t,0,s),this.values=jp.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=jp.arraySlice(this.times,0),e=jp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}exports.KeyframeTrack=Jp,Jp.prototype.TimeBufferType=Float32Array,Jp.prototype.ValueBufferType=Float32Array,Jp.prototype.DefaultInterpolation=Oe;class Qp extends Jp{}exports.BooleanKeyframeTrack=Qp,Qp.prototype.ValueTypeName="bool",Qp.prototype.ValueBufferType=Array,Qp.prototype.DefaultInterpolation=Fe,Qp.prototype.InterpolantFactoryMethodLinear=void 0,Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends Jp{}exports.ColorKeyframeTrack=Kp,Kp.prototype.ValueTypeName="color";class $p extends Jp{}function td(t,e,n,r){qp.call(this,t,e,n,r)}exports.NumberKeyframeTrack=$p,$p.prototype.ValueTypeName="number",td.prototype=Object.assign(Object.create(qp.prototype),{constructor:td,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let l=t*o;for(let c=l+o;l!==c;l+=4)Xn.slerpFlat(i,0,s,l-o,s,l,a);return i}});class ed extends Jp{InterpolantFactoryMethodLinear(t){return new td(this.times,this.values,this.getValueSize(),t)}}exports.QuaternionKeyframeTrack=ed,ed.prototype.ValueTypeName="quaternion",ed.prototype.DefaultInterpolation=Oe,ed.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends Jp{}exports.StringKeyframeTrack=nd,nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=Fe,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends Jp{}exports.VectorKeyframeTrack=rd,rd.prototype.ValueTypeName="vector";class id{constructor(t,e=-1,n,r=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Fn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(od(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(Jp.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];jp.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let c=0;c0||0===t.search(/^data\:image\/jpeg/);i.format=r?Bt:Nt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(yd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)i+=(n=this.getPoint(s/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,l=i-1;for(;a<=l;)if((o=n[r=Math.floor(a+(l-a)/2)]-s)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(i-1);const c=n[r];return(r+(s-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),s=this.getPoint(r),o=e||(i.isVector2?new On:new Yn);return o.copy(s).sub(i).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,r=[],i=[],s=[],o=new Yn,a=new wr;for(let p=0;p<=t;p++){const e=p/t;r[p]=this.getTangentAt(e,new Yn),r[p].normalize()}i[0]=new Yn,s[0]=new Yn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let p=1;p<=t;p++){if(i[p]=i[p-1].clone(),s[p]=s[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Fn.clamp(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(a.makeRotationAxis(o,t))}s[p].crossVectors(r[p],i[p])}if(!0===e){let e=Math.acos(Fn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class _d extends yd{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new On,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?o=r[(l-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),o=Md);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return n.set(Ld(o,a.x,l.x,c.x,h.x),Ld(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[r]-e,i=this.curves[r],s=i.getLength(),o=0===s?0:1-t/s;return i.getPointAt(o)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}exports.Path=Xd;class Yd extends Xd{constructor(t){super(t),this.uuid=Fn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new xi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new On).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new Yn).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Wn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new zn).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new wr).fromArray(e.value);break;default:r.uniforms[i].value=e.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const i in t.extensions)r.extensions[i]=t.extensions[i];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new On).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new On).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}exports.MaterialLoader=fm;const gm={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r0){const n=new ld(e);(i=new fd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[i],l=-l),t.yo.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=dp.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],(l=new Yd).curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let x=0,v=s.length;x1){let t=!1;const e=[];for(let n=0,r=p.length;n0&&(t||(f=u))}for(let x=0,v=p.length;x0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,l=e+e;a!==l;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){Xn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;Xn.multiplyQuaternionsFlat(t,s,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}exports.PropertyMixer=Km;const $m="\\[\\]\\.:\\/",tf=new RegExp("[\\[\\]\\.:\\/]","g"),ef="[^\\[\\]\\.:\\/]",nf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",rf=/((?:WC+[\/:])*)/.source.replace("WC",ef),sf=/(WCOD+)?/.source.replace("WCOD",nf),of=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ef),af=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ef),lf=new RegExp("^"+rf+sf+of+af+"$"),cf=["material","materials","bones"];function hf(t,e,n){const r=n||uf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function uf(t,e,n){this.path=e,this.parsedPath=n||uf.parseTrackName(e),this.node=uf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(hf.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(uf,{Composite:hf,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new uf.Composite(t,e,n):new uf(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(tf,"")},parseTrackName:function(t){const e=lf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==cf.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r=i){const s=i++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[l];e[l]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(h);for(let u=c,p=a.length;u!==p;++u){const n=a[u];h[u]=new uf(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}exports.AnimationObjectGroup=pf,pf.prototype.isAnimationObjectGroup=!0;class df{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:Ge,endingEnd:Ge};for(let l=0;l!==s;++l){const t=i[l].createInterpolant(null);o[l]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Be,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=i,a[1]=i+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case ke:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===Ne;if(0===t)return-1===i?r:s&&1==(1&i)?e-r:r;if(n===Ie){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=He,r.endingEnd=He):(r.endingStart=t?this.zeroSlopeAtStart?He:Ge:Ue,r.endingEnd=e?this.zeroSlopeAtEnd?He:Ge:Ue)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class mf extends In{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let h=0;h!==i;++h){const t=r[h],i=t.name;let l=c[i];if(void 0!==l)s[h]=l;else{if(void 0!==(l=s[h])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,i));continue}const r=e&&e._propertyBindings[h].binding.parsedPath;++(l=new Km(uf.create(n,i,r),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(l,a,i),s[h]=l}o[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l){e[l]._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let l=0;l!==a;++l)o[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new On),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new On),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Mf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=Sf,Sf.prototype.isBox2=!0;const Tf=new Yn,Ef=new Yn;class Af{constructor(t=new Yn,e=new Yn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tf.subVectors(t,this.start),Ef.subVectors(this.end,this.start);const n=Ef.dot(Ef);let r=Ef.dot(Tf)/n;return e&&(r=Fn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Lf(t){Xr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=Af,Lf.prototype=Object.create(Xr.prototype),Lf.prototype.constructor=Lf,Lf.prototype.isImmediateRenderObject=!0;const Rf=new Yn;class Cf extends Xr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ki,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,o=1,a=32;s.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eg,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=ig;class sg extends pu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ki;n.setAttribute("position",new Ci(e,3)),n.setAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=sg;const og=new Float32Array(1),ag=new Int32Array(og.buffer),lg={toHalfFloat:function(t){og[0]=t;const e=ag[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}};exports.DataUtils=lg;const cg=4,hg=8,ug=Math.pow(2,hg),pg=[.125,.215,.35,.446,.526,.582],dg=hg-cg+1+pg.length,mg=20,fg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},gg=new vi({side:p,depthWrite:!1,depthTest:!1}),xg=new os(new cs,gg),vg=new lm,{_lodPlanes:yg,_sizeLods:_g,_sigmas:bg}=Cg(),wg=new xi;let Mg=null;const Sg=(1+Math.sqrt(5))/2,Tg=1/Sg,Eg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Sg,Tg),new Yn(0,Sg,-Tg),new Yn(Tg,0,Sg),new Yn(-Tg,0,Sg),new Yn(Sg,Tg,0),new Yn(-Sg,Tg,0)];function Ag(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Lg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Ig(mg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Mg=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ng(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?ug:0,ug,ug),a.setRenderTarget(r),u&&a.render(xg,i),a.render(t,i)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ng()):null==this._equirectShader&&(this._equirectShader=Bg());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new os(yg[0],r),s=r.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=fg[t.encoding],s.outputEncoding.value=fg[e.texture.encoding],Dg(e,0,0,3*ug,2*ug),n.setRenderTarget(e),n.render(i,vg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;rmg&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${mg}`);const f=[];let g=0;for(let v=0;vhg-cg?r-hg+cg:0),3*x,2*x),a.setRenderTarget(e),a.render(c,vg)}}function Rg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Cg(){const t=[],e=[],n=[];let r=hg;for(let i=0;ihg-cg?o=pg[i-hg+cg-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),x=new Float32Array(m*p*u),v=new Float32Array(f*p*u);for(let t=0;t2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*p*t),x.set(h,m*p*t);const i=[t,t,t,t,t,t];v.set(i,f*p*t)}const y=new ki;y.setAttribute("position",new bi(g,d)),y.setAttribute("uv",new bi(x,m)),y.setAttribute("faceIndex",new bi(v,f)),t.push(y),r>cg&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pg(t){const e=new jn(3*ug,3*ug,t);return e.texture.mapping=ot,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dg(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ig(t){const e=new Float32Array(t),n=new Yn(0,1,0);return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Og()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Bg(){const t=new On(1,1);return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Og()}\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Ng(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Og()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Fg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Og(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}exports.PMREMGenerator=Lg;const zg=0;exports.LineStrip=0;const Gg=1;exports.LinePieces=1;const Hg=0;exports.NoColors=0;const Ug=1;exports.FaceColors=1;const kg=2;function Vg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Wg(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function jg(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yu(t,e)}function qg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Oh(t)}function Xg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yu(t,e)}function Yg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Zg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Jg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Qg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Kg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new bi(t,e).setUsage(Mn)}function $g(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wi(t,e)}function tx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mi(t,e)}function ex(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function nx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ti(t,e)}function rx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ei(t,e)}function ix(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ai(t,e)}function sx(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Li(t,e)}function ox(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function ax(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Pi(t,e)}function lx(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new sg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Kf(t,e)}function hx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pu(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pu(new Dp(t.geometry),new ru({color:void 0!==e?e:16777215}))}function px(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pd(t)}function dx(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xd(t)}function mx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ws(t,n)}function fx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.VertexColors=2,yd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(yd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hd.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gm.extractUrlBase(t)},hd.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Sf.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Sf.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Sf.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sf.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Qn.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},dr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Af.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Fn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Fn.floorPowerOfTwo(t)},Fn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Fn.ceilPowerOfTwo(t)},zn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},zn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},zn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},zn.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wr.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},wr.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},wr.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},wr.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},wr.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},wr.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},wr.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},wr.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},wr.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},wr.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},wr.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},wr.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},wr.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},wr.prototype.makeFrustum=function(t,e,n,r,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,s)},wr.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Qr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Xn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Xn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},br.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},br.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},br.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},li.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},li.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},li.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},li.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},li.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},li.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),li.getBarycoord(t,e,n,r,i)},li.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),li.getNormal(t,e,n,r)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Sp(this,t)},On.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},On.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},On.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Yn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Yn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Yn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Yn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Yn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Yn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Yn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Yn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Yn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Wn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),os.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(os.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Uh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Qh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Xh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(yd.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),xs.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zd.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(bi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),bi.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},bi.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},bi.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ki.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ki.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new bi(arguments[1],arguments[2])))},ki.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ki.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ki.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ki.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ki.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ki.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(xm.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(vf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(_h.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),_h.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},_h.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},gp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},gp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},yh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(ff.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(hi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(zp.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Op.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(fs.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),fh.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},fh.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},fh.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},fh.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},fh.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},fh.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},fh.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},fh.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},fh.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},fh.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},fh.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},fh.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},fh.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},fh.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},fh.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},fh.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},fh.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},fh.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},fh.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},fh.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},fh.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},fh.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},fh.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},fh.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},fh.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(fh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(jm.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Dm).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_s.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},_s.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new vd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new gd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126"); },{}],"xTGv":[function(require,module,exports) { @@ -539,15 +539,15 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} +},{}],"hyUn":[function(require,module,exports) { +"use strict";require("core-js/modules/es6.array.copy-within.js"),require("core-js/modules/es6.array.fill.js"),require("core-js/modules/es6.array.filter.js"),require("core-js/modules/es6.array.find.js"),require("core-js/modules/es6.array.find-index.js"),require("core-js/modules/es7.array.flat-map.js"),require("core-js/modules/es6.array.from.js"),require("core-js/modules/es7.array.includes.js"),require("core-js/modules/es6.array.iterator.js"),require("core-js/modules/es6.array.map.js"),require("core-js/modules/es6.array.of.js"),require("core-js/modules/es6.array.slice.js"),require("core-js/modules/es6.array.sort.js"),require("core-js/modules/es6.array.species.js"),require("core-js/modules/es6.date.to-primitive.js"),require("core-js/modules/es6.function.has-instance.js"),require("core-js/modules/es6.function.name.js"),require("core-js/modules/es6.map.js"),require("core-js/modules/es6.math.acosh.js"),require("core-js/modules/es6.math.asinh.js"),require("core-js/modules/es6.math.atanh.js"),require("core-js/modules/es6.math.cbrt.js"),require("core-js/modules/es6.math.clz32.js"),require("core-js/modules/es6.math.cosh.js"),require("core-js/modules/es6.math.expm1.js"),require("core-js/modules/es6.math.fround.js"),require("core-js/modules/es6.math.hypot.js"),require("core-js/modules/es6.math.imul.js"),require("core-js/modules/es6.math.log1p.js"),require("core-js/modules/es6.math.log10.js"),require("core-js/modules/es6.math.log2.js"),require("core-js/modules/es6.math.sign.js"),require("core-js/modules/es6.math.sinh.js"),require("core-js/modules/es6.math.tanh.js"),require("core-js/modules/es6.math.trunc.js"),require("core-js/modules/es6.number.constructor.js"),require("core-js/modules/es6.number.epsilon.js"),require("core-js/modules/es6.number.is-finite.js"),require("core-js/modules/es6.number.is-integer.js"),require("core-js/modules/es6.number.is-nan.js"),require("core-js/modules/es6.number.is-safe-integer.js"),require("core-js/modules/es6.number.max-safe-integer.js"),require("core-js/modules/es6.number.min-safe-integer.js"),require("core-js/modules/es6.number.parse-float.js"),require("core-js/modules/es6.number.parse-int.js"),require("core-js/modules/es6.object.assign.js"),require("core-js/modules/es7.object.define-getter.js"),require("core-js/modules/es7.object.define-setter.js"),require("core-js/modules/es7.object.entries.js"),require("core-js/modules/es6.object.freeze.js"),require("core-js/modules/es6.object.get-own-property-descriptor.js"),require("core-js/modules/es7.object.get-own-property-descriptors.js"),require("core-js/modules/es6.object.get-own-property-names.js"),require("core-js/modules/es6.object.get-prototype-of.js"),require("core-js/modules/es7.object.lookup-getter.js"),require("core-js/modules/es7.object.lookup-setter.js"),require("core-js/modules/es6.object.prevent-extensions.js"),require("core-js/modules/es6.object.to-string.js"),require("core-js/modules/es6.object.is.js"),require("core-js/modules/es6.object.is-frozen.js"),require("core-js/modules/es6.object.is-sealed.js"),require("core-js/modules/es6.object.is-extensible.js"),require("core-js/modules/es6.object.keys.js"),require("core-js/modules/es6.object.seal.js"),require("core-js/modules/es7.object.values.js"),require("core-js/modules/es6.promise.js"),require("core-js/modules/es7.promise.finally.js"),require("core-js/modules/es6.reflect.apply.js"),require("core-js/modules/es6.reflect.construct.js"),require("core-js/modules/es6.reflect.define-property.js"),require("core-js/modules/es6.reflect.delete-property.js"),require("core-js/modules/es6.reflect.get.js"),require("core-js/modules/es6.reflect.get-own-property-descriptor.js"),require("core-js/modules/es6.reflect.get-prototype-of.js"),require("core-js/modules/es6.reflect.has.js"),require("core-js/modules/es6.reflect.is-extensible.js"),require("core-js/modules/es6.reflect.own-keys.js"),require("core-js/modules/es6.reflect.prevent-extensions.js"),require("core-js/modules/es6.reflect.set.js"),require("core-js/modules/es6.reflect.set-prototype-of.js"),require("core-js/modules/es6.regexp.constructor.js"),require("core-js/modules/es6.regexp.flags.js"),require("core-js/modules/es6.regexp.match.js"),require("core-js/modules/es6.regexp.replace.js"),require("core-js/modules/es6.regexp.split.js"),require("core-js/modules/es6.regexp.search.js"),require("core-js/modules/es6.regexp.to-string.js"),require("core-js/modules/es6.set.js"),require("core-js/modules/es6.symbol.js"),require("core-js/modules/es7.symbol.async-iterator.js"),require("core-js/modules/es6.string.anchor.js"),require("core-js/modules/es6.string.big.js"),require("core-js/modules/es6.string.blink.js"),require("core-js/modules/es6.string.bold.js"),require("core-js/modules/es6.string.code-point-at.js"),require("core-js/modules/es6.string.ends-with.js"),require("core-js/modules/es6.string.fixed.js"),require("core-js/modules/es6.string.fontcolor.js"),require("core-js/modules/es6.string.fontsize.js"),require("core-js/modules/es6.string.from-code-point.js"),require("core-js/modules/es6.string.includes.js"),require("core-js/modules/es6.string.italics.js"),require("core-js/modules/es6.string.iterator.js"),require("core-js/modules/es6.string.link.js"),require("core-js/modules/es7.string.pad-start.js"),require("core-js/modules/es7.string.pad-end.js"),require("core-js/modules/es6.string.raw.js"),require("core-js/modules/es6.string.repeat.js"),require("core-js/modules/es6.string.small.js"),require("core-js/modules/es6.string.starts-with.js"),require("core-js/modules/es6.string.strike.js"),require("core-js/modules/es6.string.sub.js"),require("core-js/modules/es6.string.sup.js"),require("core-js/modules/es7.string.trim-left.js"),require("core-js/modules/es7.string.trim-right.js"),require("core-js/modules/es6.typed.array-buffer.js"),require("core-js/modules/es6.typed.int8-array.js"),require("core-js/modules/es6.typed.uint8-array.js"),require("core-js/modules/es6.typed.uint8-clamped-array.js"),require("core-js/modules/es6.typed.int16-array.js"),require("core-js/modules/es6.typed.uint16-array.js"),require("core-js/modules/es6.typed.int32-array.js"),require("core-js/modules/es6.typed.uint32-array.js"),require("core-js/modules/es6.typed.float32-array.js"),require("core-js/modules/es6.typed.float64-array.js"),require("core-js/modules/es6.weak-map.js"),require("core-js/modules/es6.weak-set.js"),require("core-js/modules/web.timers.js"),require("core-js/modules/web.immediate.js"),require("core-js/modules/web.dom.iterable.js");var e=n(require("stats.js/src/Stats")),r=u(require("dat.gui")),s=u(require("three")),o=require("three/examples/jsm/controls/OrbitControls.js"),t=require("../src/index.js");function i(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,s=new WeakMap;return(i=function(e){return e?s:r})(e)}function u(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var s=i(r);if(s&&s.has(e))return s.get(e);var o={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var n=t?Object.getOwnPropertyDescriptor(e,u):null;n&&(n.get||n.set)?Object.defineProperty(o,u,n):o[u]=e[u]}return o.default=e,s&&s.set(e,o),o}function n(e){return e&&e.__esModule?e:{default:e}}require("regenerator-runtime/runtime.js"),s.Mesh.prototype.raycast=t.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=t.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=t.disposeBoundsTree;var j,d,c,a,l,m,p,q,f={size:.1,rotate:!0},y=new s.Vector2,w=-1,g=!1;function h(){(a=new s.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),a.setSize(window.innerWidth,window.innerHeight),a.setClearColor(1251612,1),a.gammaOutput=!0,document.body.appendChild(a.domElement),a.domElement.style.touchAction="none",(d=new s.Scene).fog=new s.Fog(1251612,20,60);var t=new s.DirectionalLight(16777215,.5);t.position.set(1,1,1),d.add(t),d.add(new s.AmbientLight(16777215,.4));var i=new s.TorusKnotBufferGeometry(1,.4,800,400).toNonIndexed(),u=new Uint8Array(3*i.attributes.position.count);u.fill(255);var n=new s.BufferAttribute(u,3,!0);n.dynamic=!0,i.setAttribute("color",n);var h=new s.MeshStandardMaterial({color:16777215,roughness:.3,metalness:0,vertexColors:!0});(m=new s.Mesh(i,h)).geometry.computeBoundsTree(),d.add(m);var b=new s.SphereBufferGeometry(1,40,40),v=new s.MeshStandardMaterial({color:15483002,roughness:.75,metalness:0,transparent:!0,opacity:.5,premultipliedAlpha:!0,emissive:15483002,emissiveIntensity:.5});p=new s.Mesh(b,v),d.add(p),(c=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(3,3,3),c.far=100,c.updateProjectionMatrix(),j=new e.default,document.body.appendChild(j.dom);var x=new r.GUI;x.add(f,"size").min(.1).max(1).step(.1),x.add(f,"rotate"),x.open(),window.addEventListener("resize",function(){c.aspect=window.innerWidth/window.innerHeight,c.updateProjectionMatrix(),a.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("pointermove",function(e){y.x=e.clientX/window.innerWidth*2-1,y.y=-e.clientY/window.innerHeight*2+1,g=!0}),window.addEventListener("pointerdown",function(e){y.x=e.clientX/window.innerWidth*2-1,y.y=-e.clientY/window.innerHeight*2+1,w=e.button;var r=new s.Raycaster;r.setFromCamera(y,c),r.firstHitOnly=!0;var o=r.intersectObject(m,!0);g=!0,l.enabled=0===o.length},!0),window.addEventListener("pointerup",function(e){w=-1,"touch"===e.pointerType&&(g=!1)},!0),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),f.size+=5e-4*r,f.size=Math.max(Math.min(f.size,1),.1),x.updateDisplay()}),(l=new o.OrbitControls(c,a.domElement)).addEventListener("start",function(){this.active=!0}),l.addEventListener("end",function(){this.active=!1}),q=window.performance.now()}function b(){requestAnimationFrame(b),j.begin();var e=m.geometry,r=e.boundsTree,o=e.getAttribute("color"),i=e.index;if(l.active||!g)p.visible=!1;else{p.scale.setScalar(f.size);var u=new s.Raycaster;u.setFromCamera(y,c),u.firstHitOnly=!0;var n=u.intersectObject(m,!0);if(n.length){p.position.copy(n[0].point),l.enabled=!1,p.visible=!0;var h=new s.Matrix4;h.copy(m.matrixWorld).invert();var v=new s.Sphere;v.center.copy(p.position).applyMatrix4(h),v.radius=f.size;var x=[],E=new s.Vector3;if(r.shapecast(m,{intersectsBounds:function(e){var r=v.intersectsBox(e),s=e.min,o=e.max;if(r){for(var i=0;i<=1;i++)for(var u=0;u<=1;u++)for(var n=0;n<=1;n++)if(E.set(0===i?s.x:o.x,0===u?s.y:o.y,0===n?s.z:o.z),!v.containsPoint(E))return t.INTERSECTED;return t.CONTAINED}return r?t.INTERSECTED:t.NOT_INTERSECTED},intersectsTriangle:function(e,r,s){if(s||e.intersectsSphere(v)){var o=3*r;x.push(o,o+1,o+2)}return!1}}),0===w||2===w){var M=255,O=255,T=255;0===w&&(M=15,O=78,T=85);for(var z=0,C=x.length;zTHREE.js BVH Geometry Collect Triangles - \ No newline at end of file +THREE.js BVH Geometry Collect Triangles \ No newline at end of file diff --git a/example/bundle/distancecast.4107d8f2.js b/example/bundle/distancecast.4107d8f2.js index 50e7d3186..1e6a096af 100644 --- a/example/bundle/distancecast.4107d8f2.js +++ b/example/bundle/distancecast.4107d8f2.js @@ -2,7 +2,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var e=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e); },{}],"ss9A":[function(require,module,exports) { -var e=module.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e); +var e=module.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e); },{}],"M7z6":[function(require,module,exports) { module.exports=function(o){return"object"==typeof o?null!==o:"function"==typeof o}; },{}],"eT53":[function(require,module,exports) { @@ -31,7 +31,7 @@ var o=0,t=Math.random();module.exports=function(n){return"Symbol(".concat(void 0 module.exports=!1; },{}],"zGcK":[function(require,module,exports) { -var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"}); +var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"}); },{"./_core":"ss9A","./_global":"qf4T","./_library":"H21C"}],"d5RU":[function(require,module,exports) { module.exports=require("./_shared")("native-function-to-string",Function.toString); },{"./_shared":"zGcK"}],"PHot":[function(require,module,exports) { @@ -78,7 +78,11 @@ var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("spec var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)}; },{"./_array-species-constructor":"NNbH"}],"AuPh":[function(require,module,exports) { var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; -},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { +},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Hh2M":[function(require,module,exports) { +"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; +},{"./_fails":"BXiR"}],"GyG6":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(2);r(r.P+r.F*!require("./_strict-method")([].filter,!0),"Array",{filter:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"Qppk":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); },{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); @@ -134,20 +138,20 @@ var t=require("./_has"),e=require("./_to-object"),o=require("./_shared-key")("IE "use strict";var e=require("./_library"),r=require("./_export"),t=require("./_redefine"),i=require("./_hide"),n=require("./_iterators"),u=require("./_iter-create"),o=require("./_set-to-string-tag"),s=require("./_object-gpo"),a=require("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",l="keys",q="values",y=function(){return this};module.exports=function(_,p,h,k,v,w,d){u(h,p,k);var x,b,g,j=function(e){if(!c&&e in I)return I[e];switch(e){case l:case q:return function(){return new h(this,e)}}return function(){return new h(this,e)}},m=p+" Iterator",A=v==q,F=!1,I=_.prototype,O=I[a]||I[f]||v&&I[v],P=O||j(v),z=v?A?j("entries"):P:void 0,B="Array"==p&&I.entries||O;if(B&&(g=s(B.call(new _)))!==Object.prototype&&g.next&&(o(g,m,!0),e||"function"==typeof g[a]||i(g,a,y)),A&&O&&O.name!==q&&(F=!0,P=function(){return O.call(this)}),e&&!d||!c&&!F&&I[a]||i(I,a,P),n[p]=P,n[m]=y,v)if(x={values:A?P:j(q),keys:w?P:j(l),entries:z},d)for(b in x)b in I||t(I,b,x[b]);else r(r.P+r.F*(c||F),p,x);return x}; },{"./_library":"H21C","./_export":"izCb","./_redefine":"PHot","./_hide":"NXbe","./_iterators":"JO4d","./_iter-create":"ebgP","./_set-to-string-tag":"rq3q","./_object-gpo":"q6yw","./_wks":"AIP1"}],"wVEN":[function(require,module,exports) { "use strict";var e=require("./_add-to-unscopables"),r=require("./_iter-step"),t=require("./_iterators"),i=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=i(e),this._i=0,this._k=r},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])},"values"),t.Arguments=t.Array,e("keys"),e("values"),e("entries"); -},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RB6b":[function(require,module,exports) { +},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RBsu":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(1);r(r.P+r.F*!require("./_strict-method")([].map,!0),"Array",{map:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"RB6b":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_create-property");r(r.S+r.F*require("./_fails")(function(){function r(){}return!(Array.of.call(r)instanceof r)}),"Array",{of:function(){for(var r=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>r;)e(n,r,arguments[r++]);return n.length=t,n}}); -},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"Hh2M":[function(require,module,exports) { -"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; -},{"./_fails":"BXiR"}],"nrVf":[function(require,module,exports) { +},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"btFn":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_html"),i=require("./_cof"),t=require("./_to-absolute-index"),u=require("./_to-length"),a=[].slice;r(r.P+r.F*require("./_fails")(function(){e&&a.call(e)}),"Array",{slice:function(r,e){var l=u(this.length),n=i(this);if(e=void 0===e?l:e,"Array"==n)return a.call(this,r,e);for(var s=t(r,l),c=t(e,l),h=u(c-s),o=new Array(h),f=0;f=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)} -},{}],"RDO9":[function(require,module,exports) { +},{"./es6.array.iterator":"wVEN","./_object-keys":"U9a7","./_redefine":"PHot","./_global":"qf4T","./_hide":"NXbe","./_iterators":"JO4d","./_wks":"AIP1"}],"RDO9":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=function(){var t=0,l=document.createElement("div");function n(e){return l.appendChild(e.dom),e}function a(e){for(var n=0;no+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:l,setMode:a}};exports.default=e,e.Panel=function(e,t,l){var n=1/0,a=0,i=Math.round,o=i(window.devicePixelRatio||1),r=80*o,f=48*o,d=3*o,c=2*o,p=3*o,s=15*o,u=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=l,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,d,c),v.fillRect(p,s,u,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p,s,u,m),{dom:h,update:function(f,x){n=Math.min(n,f),a=Math.max(a,f),v.fillStyle=l,v.globalAlpha=1,v.fillRect(0,0,r,s),v.fillStyle=t,v.fillText(i(f)+" "+e+" ("+i(n)+"-"+i(a)+")",d,c),v.drawImage(h,p+o,s,u-o,m,p,s,u-o,m),v.fillRect(p+u-o,s,o,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p+u-o,s,o,i((1-f/x)*m))}}}; },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"dKqR":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArrayCamera=ch,exports.AxisHelper=lx,exports.BinaryTextureLoader=dx,exports.Bone=Yh,exports.BoundingBoxHelper=cx,exports.BufferAttribute=bi,exports.BufferGeometry=ki,exports.Camera=gs,exports.CanvasRenderer=fx,exports.CompressedTextureLoader=md,exports.CubicInterpolant=Xp,exports.Curve=yd,exports.DataTextureLoader=xd,exports.DiscreteInterpolant=Zp,exports.DynamicBufferAttribute=Kg,exports.EdgesHelper=hx,exports.EventDispatcher=In,exports.FileLoader=pd,exports.Float16BufferAttribute=Ri,exports.Float32Attribute=ox,exports.Float32BufferAttribute=Ci,exports.Float64Attribute=ax,exports.Float64BufferAttribute=Pi,exports.GLBufferAttribute=xf,exports.ImageBitmapLoader=Sm,exports.ImmediateRenderObject=Lf,exports.InstancedBufferAttribute=vm,exports.InstancedBufferGeometry=xm,exports.InstancedInterleavedBuffer=gf,exports.InstancedMesh=nu,exports.Int16Attribute=nx,exports.Int16BufferAttribute=Ti,exports.Int32Attribute=ix,exports.Int32BufferAttribute=Ai,exports.Int8Attribute=$g,exports.Int8BufferAttribute=wi,exports.InterleavedBuffer=_h,exports.InterleavedBufferAttribute=wh,exports.Interpolant=qp,exports.JSONLoader=gx,exports.LensFlare=vx,exports.Line=cu,exports.LineSegments=pu,exports.LinearInterpolant=Yp,exports.Loader=hd,exports.LoadingManager=ld,exports.Material=hi,exports.Mesh=os,exports.MeshFaceMaterial=Vg,exports.MeshPhysicalMaterial=Op,exports.MeshStandardMaterial=Fp,exports.MultiMaterial=Wg,exports.Object3D=Xr,exports.ParametricGeometry=exports.ParametricBufferGeometry=wp,exports.Particle=qg,exports.ParticleBasicMaterial=Zg,exports.ParticleSystem=Xg,exports.ParticleSystemMaterial=Jg,exports.PerspectiveCamera=xs,exports.PointCloud=jg,exports.PointCloudMaterial=Yg,exports.Points=yu,exports.PropertyBinding=uf,exports.QuaternionLinearInterpolant=td,exports.Raycaster=vf,exports.ShaderMaterial=fs,exports.SkinnedMesh=Xh,exports.TextureLoader=vd,exports.Uint16Attribute=rx,exports.Uint16BufferAttribute=Ei,exports.Uint32Attribute=sx,exports.Uint32BufferAttribute=Li,exports.Uint8Attribute=tx,exports.Uint8BufferAttribute=Mi,exports.Uint8ClampedAttribute=ex,exports.Uint8ClampedBufferAttribute=Si,exports.Vertex=Qg,exports.WebGLRenderTargetCube=mx,exports.WebGLRenderer=fh,exports.WebGLUtils=lh,exports.WireframeHelper=ux,exports.XHRLoader=px,exports.FloatType=exports.FlatShading=exports.FaceColors=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTexture=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CanvasTexture=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.ObjectLoader=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MaterialLoader=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.ImageLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.FontLoader=exports.Font=exports.FogExp2=exports.Fog=void 0,exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.Path=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VertexColors=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.Texture=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=void 0;const t="126";exports.REVISION="126";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const r=0;exports.CullFaceNone=r;const i=1;exports.CullFaceBack=i;const s=2;exports.CullFaceFront=s;const o=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const l=1;exports.PCFShadowMap=l;const c=2;exports.PCFSoftShadowMap=c;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const m=1;exports.FlatShading=1;const f=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const I=206;exports.DstAlphaFactor=I;const B=207;exports.OneMinusDstAlphaFactor=B;const N=208;exports.DstColorFactor=N;const F=209;exports.OneMinusDstColorFactor=F;const O=210;exports.SrcAlphaSaturateFactor=O;const z=0;exports.NeverDepth=z;const G=1;exports.AlwaysDepth=G;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=et;const nt=301;exports.CubeReflectionMapping=nt;const rt=302;exports.CubeRefractionMapping=rt;const it=303;exports.EquirectangularReflectionMapping=it;const st=304;exports.EquirectangularRefractionMapping=st;const ot=306;exports.CubeUVReflectionMapping=ot;const at=307;exports.CubeUVRefractionMapping=at;const lt=1e3;exports.RepeatWrapping=lt;const ct=1001;exports.ClampToEdgeWrapping=ct;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const mt=1005;exports.NearestMipmapLinearFilter=mt;const ft=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const It=1021;exports.AlphaFormat=It;const Bt=1022;exports.RGBFormat=Bt;const Nt=1023;exports.RGBAFormat=Nt;const Ft=1024;exports.LuminanceFormat=Ft;const Ot=1025;exports.LuminanceAlphaFormat=Ot;const zt=Nt;exports.RGBEFormat=zt;const Gt=1026;exports.DepthFormat=Gt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const re=37496;exports.RGBA_ETC2_EAC_Format=re;const ie=37808;exports.RGBA_ASTC_4x4_Format=ie;const se=37809;exports.RGBA_ASTC_5x4_Format=se;const oe=37810;exports.RGBA_ASTC_5x5_Format=oe;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const le=37812;exports.RGBA_ASTC_6x6_Format=le;const ce=37813;exports.RGBA_ASTC_8x5_Format=ce;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const me=37818;exports.RGBA_ASTC_10x8_Format=me;const fe=37819;exports.RGBA_ASTC_10x10_Format=fe;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Ie=2200;exports.LoopOnce=Ie;const Be=2201;exports.LoopRepeat=Be;const Ne=2202;exports.LoopPingPong=Ne;const Fe=2300;exports.InterpolateDiscrete=Fe;const Oe=2301;exports.InterpolateLinear=Oe;const ze=2302;exports.InterpolateSmooth=ze;const Ge=2400;exports.ZeroCurvatureEnding=Ge;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const sn=1;exports.ObjectSpaceNormalMap=sn;const on=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const ln=7681;exports.ReplaceStencilOp=7681;const cn=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const mn=512;exports.NeverStencilFunc=512;const fn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function In(){}exports.GLSL3=Dn,Object.assign(In.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e>8&255]+Bn[t>>16&255]+Bn[t>>24&255]+"-"+Bn[255&e]+Bn[e>>8&255]+"-"+Bn[e>>16&15|64]+Bn[e>>24&255]+"-"+Bn[63&n|128]+Bn[n>>8&255]+"-"+Bn[n>>16&255]+Bn[n>>24&255]+Bn[255&r]+Bn[r>>8&255]+Bn[r>>16&255]+Bn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Fn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Fn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Nn=t%2147483647),((Nn=16807*Nn%2147483647)-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),h=o((e+r)/2),u=s((e-r)/2),p=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(i){case"XYX":t.set(a*h,l*u,l*p,a*c);break;case"YZY":t.set(l*p,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*p,a*h,a*c);break;case"XZX":t.set(a*h,l*m,l*d,a*c);break;case"YXY":t.set(l*d,a*h,l*m,a*c);break;case"ZYZ":t.set(l*m,l*d,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};exports.MathUtils=exports.Math=Fn;class On{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=On,On.prototype.isVector2=!0;class zn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],m=r[0],f=r[3],g=r[6],x=r[1],v=r[4],y=r[7],_=r[2],b=r[5],w=r[8];return i[0]=s*m+o*x+a*_,i[3]=s*f+o*v+a*b,i[6]=s*g+o*y+a*w,i[1]=l*m+c*x+h*_,i[4]=l*f+c*v+h*b,i[7]=l*g+c*y+h*w,i[2]=u*m+p*x+d*_,i[5]=u*f+p*v+d*b,i[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*i*c+n*o*a+r*i*l-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*i,p=l*i-s*a,d=e*h+n*u+r*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=h*m,t[1]=(r*l-c*n)*m,t[2]=(o*n-r*s)*m,t[3]=u*m,t[4]=(c*e-r*a)*m,t[5]=(r*i-o*e)*m,t[6]=p*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*i)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,s,o){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-r*l,r*a,-r*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],l=r[4],c=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*a,r[4]=-n*s+e*l,r[7]=-n*o+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;exports.Matrix3=zn,zn.prototype.isMatrix3=!0;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;class kn extends In{constructor(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=ct,r=ct,i=gt,s=yt,o=Nt,a=bt,l=1,c=Xe){super(),Object.defineProperty(this,"id",{value:Un++}),this.uuid=Fn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new On(0,0),this.repeat=new On(1,1),this.center=new On(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=Fn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t1)switch(this.wrapS){case lt:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case lt:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}exports.Texture=kn,kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=et,kn.prototype.isTexture=!0;class Wn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const s=t.elements,o=s[0],a=s[4],l=s[8],c=s[1],h=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(h+1)/2,f=(m+1)/2,g=(a+c)/4,x=(l+p)/4,v=(u+d)/4;return t>s&&t>f?t<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(t)),i=x/n):s>f?s<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(s)),i=v/r):f<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(f)),r=v/i),this.set(n,r,i,e),this}let f=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-a)*(c-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(l-p)/f,this.z=(c-a)/f,this.w=Math.acos((o+h+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn,Wn.prototype.isVector4=!0;class jn extends In{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn,jn.prototype.isWebGLRenderTarget=!0;class qn extends jn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn,qn.prototype.isWebGLMultisampleRenderTarget=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[s+0],p=i[s+1],d=i[s+2],m=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(h!==m||a!==u||l!==p||c!==d){let t=1-o;const e=a*u+l*p+c*d+h*m,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+u*i,l=l*t+p*i,c=c*t+d*i,h=h*t+m*i,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[s],u=i[s+1],p=i[s+2],d=i[s+3];return t[e]=o*d+c*h+a*p-l*u,t[e+1]=a*d+c*u+l*h-o*p,t[e+2]=l*d+c*p+o*u-a*h,t[e+3]=c*d-o*h-a*u-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=a(n/2),p=a(r/2),d=a(i/2);switch(s){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(i-l)*t,this._z=(s-r)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(i-l)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-r)/t,this._x=(i+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+r*l-i*a,this._y=r*c+s*a+i*o-n*l,this._z=i*c+s*l+n*a-r*o,this._w=s*c-n*o-r*a-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn,Xn.prototype.isQuaternion=!0;class Yn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*r-o*n,c=a*n+o*e-i*r,h=a*r+i*n-s*e,u=-i*e-s*n-o*r;return this.x=l*a+u*-i+c*-o-h*-s,this.y=c*a+u*-s+h*-i-l*-o,this.z=h*a+u*-o+l*-s-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn,Yn.prototype.isVector3=!0;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t=new Yn(1/0,1/0,1/0),e=new Yn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$n),$n.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ar),lr.subVectors(this.max,ar),er.subVectors(t.a,ar),nr.subVectors(t.b,ar),rr.subVectors(t.c,ar),ir.subVectors(nr,er),sr.subVectors(rr,nr),or.subVectors(er,rr);let e=[0,-ir.z,ir.y,0,-sr.z,sr.y,0,-or.z,or.y,ir.z,0,-ir.x,sr.z,0,-sr.x,or.z,0,-or.x,-ir.y,ir.x,0,-sr.y,sr.x,0,-or.y,or.x,0];return!!ur(e,er,nr,rr,lr)&&(!!ur(e=[1,0,0,0,1,0,0,0,1],er,nr,rr,lr)&&(cr.crossVectors(ir,sr),ur(e=[cr.x,cr.y,cr.z],er,nr,rr,lr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $n.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize($n).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box3=Qn,Qn.prototype.isBox3=!0;const Kn=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],$n=new Yn,tr=new Qn,er=new Yn,nr=new Yn,rr=new Yn,ir=new Yn,sr=new Yn,or=new Yn,ar=new Yn,lr=new Yn,cr=new Yn,hr=new Yn;function ur(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){hr.fromArray(t,s);const o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),a=e.dot(hr),l=n.dot(hr),c=r.dot(hr);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const pr=new Qn;class dr{constructor(t=new Yn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}exports.Sphere=dr;const mr=new Yn,fr=new Yn,gr=new Yn,xr=new Yn,vr=new Yn,yr=new Yn,_r=new Yn;class br{constructor(t=new Yn,e=new Yn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mr.copy(this.direction).multiplyScalar(e).add(this.origin),mr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){fr.copy(t).add(e).multiplyScalar(.5),gr.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(fr);const i=.5*t.distanceTo(e),s=-this.direction.dot(gr),o=xr.dot(this.direction),a=-xr.dot(gr),l=xr.lengthSq(),c=Math.abs(1-s*s);let h,u,p,d;if(c>0)if(u=s*o-a,d=i*c,(h=s*a-o)>=0)if(u>=-d)if(u<=d){const t=1/c;p=(h*=t)*(h+s*(u*=t)+2*o)+u*(s*h+u+2*a)+l}else u=i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u=-i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u<=-d?p=-(h=Math.max(0,-(-s*i+o)))*h+(u=h>0?-i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l:u<=d?(h=0,p=(u=Math.min(Math.max(-i,-a),i))*(u+2*a)+l):p=-(h=Math.max(0,-(s*i+o)))*h+(u=h>0?i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l;else u=s>0?-i:i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(gr).multiplyScalar(u).add(fr),p}intersectSphere(t,e){mr.subVectors(t.center,this.origin);const n=mr.dot(this.direction),r=mr.dot(mr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,r=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,r=(t.min.x-u.x)*l),c>=0?(i=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(i=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||i>r?null:((i>n||n!=n)&&(n=i),(s=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>r?null:((o>n||n!=n)&&(n=o),(a=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mr)}intersectTriangle(t,e,n,r,i){vr.subVectors(e,t),yr.subVectors(n,t),_r.crossVectors(vr,yr);let s,o=this.direction.dot(_r);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}xr.subVectors(this.origin,t);const a=s*this.direction.dot(yr.crossVectors(xr,yr));if(a<0)return null;const l=s*this.direction.dot(vr.cross(xr));if(l<0)return null;if(a+l>o)return null;const c=-s*xr.dot(_r);return c<0?null:this.at(c/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}exports.Ray=br;class wr{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l,c,h,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wr).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Mr.setFromMatrixColumn(t,0).length(),i=1/Mr.setFromMatrixColumn(t,1).length(),s=1/Mr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-o*a,e[2]=i-t*l,e[6]=r+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t-i*o,e[4]=-s*h,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*c,e[9]=i-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=a*h,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=i-t*h,e[8]=r*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+r,e[10]=t-i*h}else if("XZY"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+i,e[5]=s*c,e[9]=n*h-r,e[2]=r*h-n,e[6]=o*c,e[10]=i*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tr,t,Er)}lookAt(t,e,n){const r=this.elements;return Rr.subVectors(t,e),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ar.crossVectors(n,Rr),0===Ar.lengthSq()&&(1===Math.abs(n.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ar.crossVectors(n,Rr)),Ar.normalize(),Lr.crossVectors(Rr,Ar),r[0]=Ar.x,r[4]=Lr.x,r[8]=Rr.x,r[1]=Ar.y,r[5]=Lr.y,r[9]=Rr.y,r[2]=Ar.z,r[6]=Lr.z,r[10]=Rr.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],m=n[6],f=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],B=r[7],N=r[11],F=r[15];return i[0]=s*b+o*T+a*R+l*I,i[4]=s*w+o*E+a*C+l*B,i[8]=s*M+o*A+a*P+l*N,i[12]=s*S+o*L+a*D+l*F,i[1]=c*b+h*T+u*R+p*I,i[5]=c*w+h*E+u*C+p*B,i[9]=c*M+h*A+u*P+p*N,i[13]=c*S+h*L+u*D+p*F,i[2]=d*b+m*T+f*R+g*I,i[6]=d*w+m*E+f*C+g*B,i[10]=d*M+m*A+f*P+g*N,i[14]=d*S+m*L+f*D+g*F,i[3]=x*b+v*T+y*R+_*I,i[7]=x*w+v*E+y*C+_*B,i[11]=x*M+v*A+y*P+_*N,i[15]=x*S+v*L+y*D+_*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+i*a*h-r*l*h-i*o*u+n*l*u+r*o*p-n*a*p)+t[7]*(+e*a*p-e*l*u+i*s*u-r*s*p+r*l*c-i*a*c)+t[11]*(+e*l*h-e*o*p-i*s*h+n*s*p+i*o*c-n*l*c)+t[15]*(-r*o*c-e*a*h+e*o*u+r*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],x=h*f*l-m*u*l+m*a*p-o*f*p-h*a*g+o*u*g,v=d*u*l-c*f*l-d*a*p+s*f*p+c*a*g-s*u*g,y=c*m*l-d*h*l+d*o*p-s*m*p-c*o*g+s*h*g,_=d*h*a-c*m*a-d*o*u+s*m*u+c*o*f-s*h*f,b=e*x+n*v+r*y+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=x*w,t[1]=(m*u*i-h*f*i-m*r*p+n*f*p+h*r*g-n*u*g)*w,t[2]=(o*f*i-m*a*i+m*r*l-n*f*l-o*r*g+n*a*g)*w,t[3]=(h*a*i-o*u*i-h*r*l+n*u*l+o*r*p-n*a*p)*w,t[4]=v*w,t[5]=(c*f*i-d*u*i+d*r*p-e*f*p-c*r*g+e*u*g)*w,t[6]=(d*a*i-s*f*i-d*r*l+e*f*l+s*r*g-e*a*g)*w,t[7]=(s*u*i-c*a*i+c*r*l-e*u*l-s*r*p+e*a*p)*w,t[8]=y*w,t[9]=(d*h*i-c*m*i-d*n*p+e*m*p+c*n*g-e*h*g)*w,t[10]=(s*m*i-d*o*i+d*n*l-e*m*l-s*n*g+e*o*g)*w,t[11]=(c*o*i-s*h*i-c*n*l+e*h*l+s*n*p-e*o*p)*w,t[12]=_*w,t[13]=(c*m*r-d*h*r+d*n*u-e*m*u-c*n*f+e*h*f)*w,t[14]=(d*o*r-s*m*r-d*n*a+e*m*a+s*n*f-e*o*f)*w,t[15]=(s*h*r-c*o*r+c*n*a-e*h*a-s*n*u+e*o*u)*w,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,l=i*s,c=i*o;return this.set(l*s+n,l*o-r*a,l*a+r*o,0,l*o+r*a,c*o+n,c*a-r*s,0,l*a-r*o,c*a+r*s,i*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,l=i+i,c=s+s,h=o+o,u=i*l,p=i*c,d=i*h,m=s*c,f=s*h,g=o*h,x=a*l,v=a*c,y=a*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(m+g))*_,r[1]=(p+y)*_,r[2]=(d-v)*_,r[3]=0,r[4]=(p-y)*b,r[5]=(1-(u+g))*b,r[6]=(f+x)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(f-x)*w,r[10]=(1-(u+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Mr.set(r[0],r[1],r[2]).length();const s=Mr.set(r[4],r[5],r[6]).length(),o=Mr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Sr.copy(this);const a=1/i,l=1/s,c=1/o;return Sr.elements[0]*=a,Sr.elements[1]*=a,Sr.elements[2]*=a,Sr.elements[4]*=l,Sr.elements[5]*=l,Sr.elements[6]*=l,Sr.elements[8]*=c,Sr.elements[9]*=c,Sr.elements[10]*=c,e.setFromRotationMatrix(Sr),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),h=(n+r)/(n-r),u=-(s+i)/(s-i),p=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),l=1/(n-r),c=1/(s-i),h=(e+t)*a,u=(n+r)*l,p=(s+i)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wr,wr.prototype.isMatrix4=!0;const Mr=new Yn,Sr=new wr,Tr=new Yn(0,0,0),Er=new Yn(1,1,1),Ar=new Yn,Lr=new Yn,Rr=new Yn,Cr=new wr,Pr=new Xn;class Dr{constructor(t=0,e=0,n=0,r=Dr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Fn.clamp,i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Pr.setFromEuler(this),this.setFromQuaternion(Pr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Dr,Dr.prototype.isEuler=!0,Dr.DefaultOrder="XYZ",Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ir{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){r.children=[];for(let e=0;e0){r.animations=[];for(let e=0;e0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function s(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n1?void 0:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Jr.getNormalMatrix(t),r=this.coplanarPoint(Yr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}exports.Plane=Qr,Qr.prototype.isPlane=!0;const Kr=new Yn,$r=new Yn,ti=new Yn,ei=new Yn,ni=new Yn,ri=new Yn,ii=new Yn,si=new Yn,oi=new Yn,ai=new Yn;class li{constructor(t=new Yn,e=new Yn,n=new Yn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Yn),r.subVectors(n,e),Kr.subVectors(t,e),r.cross(Kr);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Kr.subVectors(r,e),$r.subVectors(n,e),ti.subVectors(t,e);const s=Kr.dot(Kr),o=Kr.dot($r),a=Kr.dot(ti),l=$r.dot($r),c=$r.dot(ti),h=s*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Yn),0===h)return i.set(-2,-1,-1);const u=1/h,p=(l*a-o*c)*u,d=(s*c-o*a)*u;return i.set(1-p-d,d,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ei),a.set(0,0),a.addScaledVector(i,ei.x),a.addScaledVector(s,ei.y),a.addScaledVector(o,ei.z),a}static isFrontFacing(t,e,n,r){return Kr.subVectors(n,e),$r.subVectors(t,e),Kr.cross($r).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Kr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Kr.cross($r).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return li.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qr),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return li.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return li.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return li.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return li.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,r=this.b,i=this.c;let s,o;ni.subVectors(r,n),ri.subVectors(i,n),si.subVectors(t,n);const a=ni.dot(si),l=ri.dot(si);if(a<=0&&l<=0)return e.copy(n);oi.subVectors(t,r);const c=ni.dot(oi),h=ri.dot(oi);if(c>=0&&h<=c)return e.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(ni,s);ai.subVectors(t,i);const p=ni.dot(ai),d=ri.dot(ai);if(d>=0&&p<=d)return e.copy(i);const m=p*l-a*d;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),e.copy(n).addScaledVector(ri,o);const f=c*d-p*h;if(f<=0&&h-c>=0&&p-d>=0)return ii.subVectors(i,r),o=(h-c)/(h-c+(p-d)),e.copy(r).addScaledVector(ii,o);const g=1/(f+m+u);return s=m*g,o=u*g,e.copy(n).addScaledVector(ni,s).addScaledVector(ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=li;let ci=0;function hi(){Object.defineProperty(this,"id",{value:ci++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}hi.prototype=Object.assign(Object.create(In.prototype),{constructor:hi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(hi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},di={h:0,s:0,l:0};function mi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function fi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=mi(i,r,t+1/3),this.g=mi(i,r,t),this.b=mi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ui[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}copyLinearToSRGB(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const l=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=l<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(ne&&(e=t[n]);return e}Object.defineProperty(bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r65535?Li:Ei)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new zn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fi.makeRotationX(t),this.applyMatrix4(Fi),this},rotateY:function(t){return Fi.makeRotationY(t),this.applyMatrix4(Fi),this},rotateZ:function(t){return Fi.makeRotationZ(t),this.applyMatrix4(Fi),this},translate:function(t,e,n){return Fi.makeTranslation(t,e,n),this.applyMatrix4(Fi),this},scale:function(t,e,n){return Fi.makeScale(t,e,n),this.applyMatrix4(Fi),this},lookAt:function(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],r=e.toJSON(t.data);""!==e.name&&(r.name=e.name),t.data.attributes[a]=r}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ki).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const l in r){const t=r[l];this.setAttribute(l,t.clone(e))}const i=t.morphAttributes;for(const l in i){const t=[],n=i[l];for(let r=0,i=n.length;rn.far?null:{distance:c,point:ss.clone(),object:t}}function ls(t,e,n,r,i,s,o,a,l,c,h,u){qi.fromBufferAttribute(i,c),Xi.fromBufferAttribute(i,h),Yi.fromBufferAttribute(i,u);const p=t.morphTargetInfluences;if(e.morphTargets&&s&&p){Ki.set(0,0,0),$i.set(0,0,0),ts.set(0,0,0);for(let t=0,e=s.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(i),!1===t.ray.intersectsSphere(ji))return;if(Vi.copy(i).invert(),Wi.copy(t.ray).applyMatrix4(Vi),null!==n.boundingBox&&!1===Wi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;n0?1:-1,c.push(A.x,A.y,A.z),h.push(a/f),h.push(1-o/g),T+=1}}for(let o=0;o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},gs.prototype=Object.assign(Object.create(Xr.prototype),{constructor:gs,isCamera:!0,copy:function(t,e){return Xr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),xs.prototype=Object.assign(Object.create(gs.prototype),{constructor:xs,isPerspectiveCamera:!0,copy:function(t,e){return gs.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xr.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const vs=90,ys=1;class _s extends Xr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new xs(vs,ys,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(1,0,0)),this.add(r);const i=new xs(vs,ys,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(-1,0,0)),this.add(i);const s=new xs(vs,ys,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Yn(0,1,0)),this.add(s);const o=new xs(vs,ys,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Yn(0,-1,0)),this.add(o);const a=new xs(vs,ys,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const l=new xs(vs,ys,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Yn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}exports.CubeCamera=_s;class bs extends kn{constructor(t,e,n,r,i,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:nt,n,r,i,s,o=void 0!==o?o:Bt,a,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}exports.CubeTexture=bs,bs.prototype.isCubeTexture=!0;class ws extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bs(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:gt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Nt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new cs(5,5,5),i=new fs({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});i.uniforms.tEquirect.value=e;const s=new os(r,i),o=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new _s(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}exports.WebGLCubeRenderTarget=ws,ws.prototype.isWebGLCubeRenderTarget=!0;class Ms extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ut,this.minFilter=void 0!==c?c:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}exports.DataTexture=Ms,Ms.prototype.isDataTexture=!0;const Ss=new dr,Ts=new Yn;class Es{constructor(t=new Qr,e=new Qr,n=new Qr,r=new Qr,i=new Qr,s=new Qr){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],m=n[11],f=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(o-r,h-a,m-u,v-f).normalize(),e[1].setComponents(o+r,h+a,m+u,v+f).normalize(),e[2].setComponents(o+i,h+l,m+p,v+g).normalize(),e[3].setComponents(o-i,h-l,m-p,v-g).normalize(),e[4].setComponents(o-s,h-c,m-d,v-x).normalize(),e[5].setComponents(o+s,h+c,m+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version=0){const s=l[e];if(void 0!==s){const e=s.normalized,i=s.itemSize,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(f(r,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r+0,1),f(r+1,1),f(r+2,1),f(r+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r+0,4,o,!1,64,0),t.vertexAttribPointer(r+1,4,o,!1,64,16),t.vertexAttribPointer(r+2,4,o,!1,64,32),t.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)u(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function rl(t,e,n,r){const i=r.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,r){t.drawArrays(s,e,r),n.update(r,s,1)},this.renderInstances=function(r,o,a){if(0===a)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,r,o,a),n.update(o,s,a)}}function il(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=s||e.has("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:s?t.getParameter(36183):0}}function sl(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Qr,a=new zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==i||null===c){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length0){const o=t.getRenderTarget(),a=new ws(s.height/2);return a.fromEquirectangularTexture(t,i),e.set(i,a),t.setRenderTarget(o),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function al(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ll(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e65535?Li:Ei)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===i[e.id]?e:(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n0)return t;const i=e*n;let s=bl[i];if(void 0===s&&(s=new Float32Array(i),bl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function Al(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n/gm;function Rc(t){return t.replace(Lc,Cc)}function Cc(t,e){const n=Ka[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Pc=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Dc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ic(t){return t.replace(Dc,Nc).replace(Pc,Bc)}function Bc(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nc(t,e,n,r)}function Nc(t,e,n,r){let i="";for(let s=parseInt(e);s0?t.gammaFactor:1,d=n.isWebGL2?"":wc(n),m=Mc(s),f=i.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[m].filter(Tc).join("\n")).length>0&&(g+="\n"),(x=[d,m].filter(Tc).join("\n")).length>0&&(x+="\n")):(g=[Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Tc).join("\n"),x=[d,Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?Ka.tonemapping_pars_fragment:"",n.toneMapping!==Z?bc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ka.encodings_pars_fragment,n.map?yc("mapTexelToLinear",n.mapEncoding):"",n.matcap?yc("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?yc("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?yc("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?yc("lightMapTexelToLinear",n.lightMapEncoding):"",_c("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Tc).join("\n")),o=Ac(o=Ec(o=Rc(o),n),n),a=Ac(a=Ec(a=Rc(a),n),n),o=Ic(o),a=Ic(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const y=v+x+a,_=mc(i,35633,v+g+o),b=mc(i,35632,y);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(f).trim(),e=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const e=vc(i,_,"vertex"),n=vc(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new dc(i,f)),w},this.getAttributes=function(){return void 0===M&&(M=Sc(i,f)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=fc++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}function kc(t,e,n,r,i,s){const o=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let m=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(i,o,g,v,y){const _=v.fog,b=i.isMeshStandardMaterial?v.environment:null,w=e.get(i.envMap||b),M=f[i.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===d,flipSided:i.side===p,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&r.sort(t||Wc),i.length>1&&i.sort(e||jc)}}}function Xc(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new qc(t),e.set(n,[i])):r>=e.get(n).length?(i=new qc(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new xi};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Zc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Jc=0;function Qc(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Kc(t,e){const n=new Yc,r=Zc(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)i.probe.push(new Yn);const s=new Yn,o=new wr,a=new wr;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,h=0,u=0,p=0,d=0,m=0,f=0,g=0;s.sort(Qc);for(let t=0,e=s.length;t0&&(e.isWebGL2?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=$a.LTC_HALF_1,i.rectAreaLTC2=$a.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=a,i.ambient[2]=l;const x=i.hash;x.directionalLength===c&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===m&&x.numPointShadows===f&&x.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=p,i.point.length=h,i.hemi.length=d,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=f,i.spotShadowMatrix.length=g,x.directionalLength=c,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=m,x.numPointShadows=f,x.numSpotShadows=g,i.version=Jc++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p=n.get(r).length?(s=new $c(t,e),n.get(r).push(s)):s=n.get(r)[i],s},dispose:function(){n=new WeakMap}}}class eh extends hi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}exports.MeshDepthMaterial=eh,eh.prototype.isMeshDepthMaterial=!0;class nh extends hi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}exports.MeshDistanceMaterial=nh,nh.prototype.isMeshDistanceMaterial=!0;var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ih="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let r=new Es;const i=new On,s=new On,o=new Wn,a=[],c=[],m={},f={0:p,1:u,2:d},x=new fs({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new On},radius:{value:4}},vertexShader:ih,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new ki;y.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new os(y,x),b=this;function w(n,r){const i=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,_,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=a[r];return void 0===i&&(i=new eh({depthPacking:nn,morphTargets:t,skinning:e}),a[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=c[r];return void 0===i&&(i=new nh({morphTargets:t,skinning:e}),c[r]=i),i}function T(e,n,r,i,s,o,a){let l=null,c=M,u=e.customDepthMaterial;if(!0===i.isPointLight&&(c=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(t,i,!0===e.isInstancedMesh)}else l=u;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=a===h?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=s,l.farDistance=o),l}function E(n,i,s,o,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;ln||i.y>n)&&(i.x>n&&(s.x=Math.floor(n/p.x),i.x=s.x*p.x,u.mapSize.x=s.x),i.y>n&&(s.y=Math.floor(n/p.y),i.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new jn(i.x,i.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(ot=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),st=ot>=2);let lt=null,ct={};const ht=new Wn,ut=new Wn;function pt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;or||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Fn.floorPowerOfTwo:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===d&&(d=f(s,o));const a=n?f(s,o):d;return a.width=s,a.height=o,a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,i,s){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,s))}function _(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function b(t){return t===ut||t===pt||t===mt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),s=r.get(n);if(!e)return;void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function E(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;C(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=o||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const u=h[0],p=x(u)||a,d=s.convert(r.format),m=s.convert(r.type),f=_(r.internalFormat,d,m);let b;if(R(34067,r,p),o){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),o.memory.textures++)}function P(e,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==ut&&t.minFilter!==gt)}(r)&&!1===x(r.image),c=g(r.image,l,!1,h),u=x(c)||a,p=s.convert(r.format);let d,m=s.convert(r.type),f=_(r.internalFormat,p,m);R(o,r,u);const b=r.mipmaps;if(r.isDepthTexture)f=6402,a?f=r.type===At?36012:r.type===Et?33190:r.type===Dt?35056:33189:r.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===f&&r.type!==St&&r.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=St,m=s.convert(r.type)),r.format===Ht&&6402===f&&(f=34041,r.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Dt,m=s.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t0&&u){for(let t=0,e=b.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,p=i.isDataTexture3D||i.isDataTexture2DArray,d=x(e)||a;if(!a||i.format!==Bt||i.type!==At&&i.type!==Lt||(i.format=Nt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(i.format),r=s.convert(i.type),o=_(i.internalFormat,n,r),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),I(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),R(34067,i,d);for(let t=0;t<6;t++)D(l.__webglFramebuffer[t],e,36064,34069+t);v(i,d)&&y(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;p&&(a?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),R(t,i,d),D(l.__webglFramebuffer,e,36064,t),v(i,d)&&y(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const i=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;n.bindTexture(i,s),y(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===It)return 6406;if(t===Bt)return 6407;if(t===Nt)return 6408;if(t===Ft)return 6409;if(t===Ot)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===re)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===re)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ie||t===se||t===oe||t===ae||t===le||t===ce||t===he||t===ue||t===pe||t===de||t===me||t===fe||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(t=[]){xs.call(this),this.cameras=t}ch.prototype=Object.assign(Object.create(xs.prototype),{constructor:ch,isArrayCamera:!0});class hh extends Xr{constructor(){super(),this.type="Group"}}function uh(){this._targetRay=null,this._grip=null,this._hand=null}function ph(t,e){const n=this;let r=null,i=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new xs;h.layers.enable(1),h.viewport=new Wn;const u=new xs;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new ch;d.layers.enable(1),d.layers.enable(2);let m=null,f=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){c.forEach(function(t,e){t.disconnect(e)}),c.clear(),m=null,f=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=r.inputSources;for(let n=0;n0&&wt(s,t,e),o.length>0&&wt(o,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==_&&(X.updateRenderTargetMipmap(_),X.updateMultisampleRenderTarget(_)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,d.pop(),u=d.length>0?d[d.length-1]:null},this.setFramebuffer=function(t){x!==t&&null===_&&ht.bindFramebuffer(36160,t),x=t},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=x,i=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=o[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),E=t.scissorTest}else S.copy(D).multiplyScalar(R).floor(),T.copy(I).multiplyScalar(R).floor(),E=B;if(b!==r&&(ht.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(T),W.setScissorTest(E),i){const r=q.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(s){const r=q.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==b&&(ht.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Nt&<.convert(l)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===Lt&&(k.has("EXT_color_buffer_half_float")||V.isWebGL2&&k.has("EXT_color_buffer_float"));if(!(c===bt||lt.convert(c)===ht.getParameter(35738)||c===At&&(V.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ht.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),o=lt.convert(e.format);X.setTexture2D(e,0),ht.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=lt.convert(n.format),a=lt.convert(n.type);X.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let h;if(r.isDataTexture3D)X.setTexture3D(r,0),h=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),h=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const u=ht.getParameter(3314),p=ht.getParameter(32878),d=ht.getParameter(3316),m=ht.getParameter(3315),g=ht.getParameter(32877);ht.pixelStorei(3314,s),ht.pixelStorei(32878,o),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),ht.texSubImage3D(h,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,a),ht.pixelStorei(3314,u),ht.pixelStorei(32878,p),ht.pixelStorei(3316,d),ht.pixelStorei(3315,m),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(h),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}exports.Group=hh,hh.prototype.isGroup=!0,Object.assign(uh.prototype,{constructor:uh,getHandSpace:function(){return null===this._hand&&(this._hand=new hh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new hh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new hh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new hh;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const r=l.joints[s.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),this}}),Object.assign(ph.prototype,In.prototype);class gh extends fh{}exports.WebGL1Renderer=gh,gh.prototype.isWebGL1Renderer=!0;class xh{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new xh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=xh,xh.prototype.isFogExp2=!0;class vh{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new vh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=vh,vh.prototype.isFog=!0;class yh extends Xr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function _h(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}exports.Scene=yh,yh.prototype.isScene=!0,Object.defineProperty(_h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_h.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;rt.far||e.push({distance:a,point:Th.clone(),uv:li.getUV(Th,Ph,Dh,Ih,Bh,Nh,Fh,new On),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function zh(t,e,n,r,i,s){Lh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Rh.x=s*Lh.x-i*Lh.y,Rh.y=i*Lh.x+s*Lh.y):Rh.copy(Lh),t.copy(e),t.x+=Rh.x,t.y+=Rh.y,t.applyMatrix4(Ch)}exports.Sprite=Oh,Oh.prototype.isSprite=!0;const Gh=new Yn,Hh=new Yn;class Uh extends Xr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n0){let n,r;for(n=1,r=e.length;n0){Gh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Gh);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Gh.setFromMatrixPosition(t.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=Gh.distanceTo(Hh)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;ro)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);pt.far||e.push({distance:p,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,s=i.count-1;no)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const hu=new Yn,uu=new Yn;function pu(t,e){cu.call(this,t,e),this.type="LineSegments"}pu.prototype=Object.assign(Object.create(cu.prototype),{constructor:pu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;ti.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}yu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:yu,isPoints:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xu.copy(n.boundingSphere),xu.applyMatrix4(r),xu.radius+=i,!1===t.ray.intersectsSphere(xu))return;fu.copy(r).invert(),gu.copy(t.ray).applyMatrix4(fu);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class bu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.format=void 0!==o?o:Bt,this.minFilter=void 0!==s?s:gt,this.magFilter=void 0!==i?i:gt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}exports.VideoTexture=bu,bu.prototype.isVideoTexture=!0;class wu extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}exports.CompressedTexture=wu,wu.prototype.isCompressedTexture=!0;class Mu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.needsUpdate=!0}}exports.CanvasTexture=Mu,Mu.prototype.isCanvasTexture=!0;class Su extends kn{constructor(t,e,n,r,i,s,o,a,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=St),void 0===n&&c===Ht&&(n=Dt),super(null,r,i,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}}exports.DepthTexture=Su,Su.prototype.isDepthTexture=!0;class Tu extends ki{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],l=new Yn,c=new On;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const i=n+h/e*r;l.x=t*Math.cos(i),l.y=t*Math.sin(i),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[u]/t+1)/2,c.y=(s[u+1]/t+1)/2,a.push(c.x,c.y)}for(let h=1;h<=e;h++)i.push(h,h+1,0);this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("normal",new Ci(o,3)),this.setAttribute("uv",new Ci(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Tu;class Eu extends ki{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],h=[],u=[],p=[];let d=0;const m=[],f=n/2;let g=0;function x(n){const i=d,s=new On,m=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=r;t++)h.push(0,f*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=r;t++){const e=t/r*a+o,n=Math.cos(e),i=Math.sin(e);m.x=v*i,m.y=f*y,m.z=v*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*i*y+.5,p.push(s.x,s.y),d++}for(let t=0;t0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Eu;class Au extends Eu{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}}exports.ConeGeometry=exports.ConeBufferGeometry=Au;class Lu extends ki{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),l=i-o;for(let t=0;t<=l;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/l)}for(let o=0;o.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(i.slice(),3)),this.setAttribute("uv",new Ci(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Lu;class Ru extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Ru;const Cu=new Yn,Pu=new Yn,Du=new Yn,Iu=new li;class Bu extends ki{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Fn.DEG2RAD*e),i=t.getIndex(),s=t.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let p=0;p80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),p>h&&(h=p);d=0!==(d=Math.max(c-a,h-l))?1/d:0}return zu(s,o,n,a,l,d),o}};function Fu(t,e,n,r,i){let s,o;if(i===pp(t,e,n,r)>0)for(s=e;s=e;s-=r)o=cp(s,t[s],t[s+1],o);return o&&ep(o,o.next)&&(hp(o),o=o.next),o}function Ou(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!ep(r,r.next)&&0!==tp(r.prev,r,r.next))r=r.next;else{if(hp(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zu(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yu(t,r,i,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hu(t,r,i,s):Gu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),hp(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?zu(t=Uu(Ou(t),e,n),e,n,r,i,s,2):2===o&&ku(t,e,n,r,i,s):zu(Ou(t),e,n,r,i,s,1);break}}function Gu(t){const e=t.prev,n=t,r=t.next;if(tp(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ku(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&tp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Hu(t,e,n,r){const i=t.prev,s=t,o=t.next;if(tp(i,s,o)>=0)return!1;const a=i.xs.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,h=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=Ju(a,l,e,n,r),p=Ju(c,h,e,n,r);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Uu(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!ep(i,s)&&np(i,r,r.next,s)&&op(i,s)&&op(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),hp(r),hp(r.next),r=t=s),r=r.next}while(r!==t);return Ou(r)}function ku(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&$u(o,t)){let a=lp(o,t);return o=Ou(o,o.next),a=Ou(a,a.next),zu(o,e,n,r,i,s),void zu(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function Vu(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&r!==n.x&&Ku(is.x||n.x===s.x&&Xu(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}function Xu(t,e){return tp(t.prev,t,e.prev)<0&&tp(e.next,t,t.next)<0}function Yu(t,e,n,r){let i=t;do{null===i.z&&(i.z=Ju(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zu(i)}function Zu(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function Ju(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Qu(t){let e=t,n=t;do{(e.x=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function $u(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(op(t,e)&&op(e,t)&&ap(t,e)&&(tp(t.prev,t,e.prev)||tp(t,e.prev,e))||ep(t,e)&&tp(t.prev,t,t.next)>0&&tp(e.prev,e,e.next)>0)}function tp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ep(t,e){return t.x===e.x&&t.y===e.y}function np(t,e,n,r){const i=ip(tp(t,e,n)),s=ip(tp(t,e,r)),o=ip(tp(n,r,t)),a=ip(tp(n,r,e));return i!==s&&o!==a||(!(0!==i||!rp(t,n,e))||(!(0!==s||!rp(t,r,e))||(!(0!==o||!rp(n,t,r))||!(0!==a||!rp(n,e,r)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ip(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&np(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function op(t,e){return tp(t.prev,t,t.next)<0?tp(t,e,t.next)>=0&&tp(t,t.prev,e)>=0:tp(t,e,t.prev)<0||tp(t,t.next,e)<0}function ap(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function lp(t,e){const n=new up(t.i,t.x,t.y),r=new up(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cp(t,e,n,r){const i=new up(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function hp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function up(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pp(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function fp(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(l*l+c*c),d=e.x-a/u,m=e.y+o/u,f=((n.x-c/p-d)*c-(n.y+l/p-m)*l)/(o*c-a*l),g=(r=d+o*f-t.x)*r+(i=m+a*f-t.y)*i;if(g<=2)return new On(r,i);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(h)):(r=o,i=a,s=Math.sqrt(h/2))}return new On(r/s,i/s)}const P=[];for(let e=0,n=E.length,r=n-1,i=e+1;e=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*d;t=0?(t(p-1e-5,r,c),h.subVectors(l,c)):(t(p+1e-5,r,c),h.subVectors(c,l)),r-1e-5>=0?(t(p,r-1e-5,c),u.subVectors(l,c)):(t(p,r+1e-5,c),u.subVectors(c,l)),a.crossVectors(h,u).normalize(),s.push(a.x,a.y,a.z),o.push(p,r)}}for(let d=0;d0)&&p.push(e,r,o),(g!==n-1||a=r)){a.push(t.times[s]);for(let n=0;ns.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=e.times[u]){const t=u*l+a,n=t+l-a;p=jp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=l-a;t.evaluate(s),p=jp.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=i.times.length;for(let t=0;t=i)break t;{const o=e[1];t=(i=e[--n-1]))break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==i||s!==r){i>=s&&(i=(s=Math.max(s,1))-1);const t=this.getValueSize();this.times=jp.arraySlice(n,i,s),this.values=jp.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&jp.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=jp.arraySlice(this.times),e=jp.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===ze,i=t.length-1;let s=1;for(let o=1;o0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=jp.arraySlice(t,0,s),this.values=jp.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=jp.arraySlice(this.times,0),e=jp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}exports.KeyframeTrack=Jp,Jp.prototype.TimeBufferType=Float32Array,Jp.prototype.ValueBufferType=Float32Array,Jp.prototype.DefaultInterpolation=Oe;class Qp extends Jp{}exports.BooleanKeyframeTrack=Qp,Qp.prototype.ValueTypeName="bool",Qp.prototype.ValueBufferType=Array,Qp.prototype.DefaultInterpolation=Fe,Qp.prototype.InterpolantFactoryMethodLinear=void 0,Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends Jp{}exports.ColorKeyframeTrack=Kp,Kp.prototype.ValueTypeName="color";class $p extends Jp{}function td(t,e,n,r){qp.call(this,t,e,n,r)}exports.NumberKeyframeTrack=$p,$p.prototype.ValueTypeName="number",td.prototype=Object.assign(Object.create(qp.prototype),{constructor:td,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let l=t*o;for(let c=l+o;l!==c;l+=4)Xn.slerpFlat(i,0,s,l-o,s,l,a);return i}});class ed extends Jp{InterpolantFactoryMethodLinear(t){return new td(this.times,this.values,this.getValueSize(),t)}}exports.QuaternionKeyframeTrack=ed,ed.prototype.ValueTypeName="quaternion",ed.prototype.DefaultInterpolation=Oe,ed.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends Jp{}exports.StringKeyframeTrack=nd,nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=Fe,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends Jp{}exports.VectorKeyframeTrack=rd,rd.prototype.ValueTypeName="vector";class id{constructor(t,e=-1,n,r=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Fn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(od(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(Jp.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];jp.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let c=0;c0||0===t.search(/^data\:image\/jpeg/);i.format=r?Bt:Nt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(yd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)i+=(n=this.getPoint(s/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,l=i-1;for(;a<=l;)if((o=n[r=Math.floor(a+(l-a)/2)]-s)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(i-1);const c=n[r];return(r+(s-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),s=this.getPoint(r),o=e||(i.isVector2?new On:new Yn);return o.copy(s).sub(i).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,r=[],i=[],s=[],o=new Yn,a=new wr;for(let p=0;p<=t;p++){const e=p/t;r[p]=this.getTangentAt(e,new Yn),r[p].normalize()}i[0]=new Yn,s[0]=new Yn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let p=1;p<=t;p++){if(i[p]=i[p-1].clone(),s[p]=s[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Fn.clamp(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(a.makeRotationAxis(o,t))}s[p].crossVectors(r[p],i[p])}if(!0===e){let e=Math.acos(Fn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class _d extends yd{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new On,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?o=r[(l-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),o=Md);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return n.set(Ld(o,a.x,l.x,c.x,h.x),Ld(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[r]-e,i=this.curves[r],s=i.getLength(),o=0===s?0:1-t/s;return i.getPointAt(o)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}exports.Path=Xd;class Yd extends Xd{constructor(t){super(t),this.uuid=Fn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new xi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new On).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new Yn).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Wn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new zn).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new wr).fromArray(e.value);break;default:r.uniforms[i].value=e.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const i in t.extensions)r.extensions[i]=t.extensions[i];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new On).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new On).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}exports.MaterialLoader=fm;const gm={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r0){const n=new ld(e);(i=new fd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[i],l=-l),t.yo.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=dp.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],(l=new Yd).curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let x=0,v=s.length;x1){let t=!1;const e=[];for(let n=0,r=p.length;n0&&(t||(f=u))}for(let x=0,v=p.length;x0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,l=e+e;a!==l;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){Xn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;Xn.multiplyQuaternionsFlat(t,s,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}exports.PropertyMixer=Km;const $m="\\[\\]\\.:\\/",tf=new RegExp("[\\[\\]\\.:\\/]","g"),ef="[^\\[\\]\\.:\\/]",nf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",rf=/((?:WC+[\/:])*)/.source.replace("WC",ef),sf=/(WCOD+)?/.source.replace("WCOD",nf),of=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ef),af=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ef),lf=new RegExp("^"+rf+sf+of+af+"$"),cf=["material","materials","bones"];function hf(t,e,n){const r=n||uf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function uf(t,e,n){this.path=e,this.parsedPath=n||uf.parseTrackName(e),this.node=uf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(hf.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(uf,{Composite:hf,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new uf.Composite(t,e,n):new uf(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(tf,"")},parseTrackName:function(t){const e=lf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==cf.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r=i){const s=i++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[l];e[l]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(h);for(let u=c,p=a.length;u!==p;++u){const n=a[u];h[u]=new uf(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}exports.AnimationObjectGroup=pf,pf.prototype.isAnimationObjectGroup=!0;class df{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:Ge,endingEnd:Ge};for(let l=0;l!==s;++l){const t=i[l].createInterpolant(null);o[l]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Be,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=i,a[1]=i+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case ke:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===Ne;if(0===t)return-1===i?r:s&&1==(1&i)?e-r:r;if(n===Ie){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=He,r.endingEnd=He):(r.endingStart=t?this.zeroSlopeAtStart?He:Ge:Ue,r.endingEnd=e?this.zeroSlopeAtEnd?He:Ge:Ue)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class mf extends In{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let h=0;h!==i;++h){const t=r[h],i=t.name;let l=c[i];if(void 0!==l)s[h]=l;else{if(void 0!==(l=s[h])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,i));continue}const r=e&&e._propertyBindings[h].binding.parsedPath;++(l=new Km(uf.create(n,i,r),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(l,a,i),s[h]=l}o[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l){e[l]._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let l=0;l!==a;++l)o[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new On),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new On),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Mf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=Sf,Sf.prototype.isBox2=!0;const Tf=new Yn,Ef=new Yn;class Af{constructor(t=new Yn,e=new Yn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tf.subVectors(t,this.start),Ef.subVectors(this.end,this.start);const n=Ef.dot(Ef);let r=Ef.dot(Tf)/n;return e&&(r=Fn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Lf(t){Xr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=Af,Lf.prototype=Object.create(Xr.prototype),Lf.prototype.constructor=Lf,Lf.prototype.isImmediateRenderObject=!0;const Rf=new Yn;class Cf extends Xr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ki,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,o=1,a=32;s.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eg,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=ig;class sg extends pu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ki;n.setAttribute("position",new Ci(e,3)),n.setAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=sg;const og=new Float32Array(1),ag=new Int32Array(og.buffer),lg={toHalfFloat:function(t){og[0]=t;const e=ag[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}};exports.DataUtils=lg;const cg=4,hg=8,ug=Math.pow(2,hg),pg=[.125,.215,.35,.446,.526,.582],dg=hg-cg+1+pg.length,mg=20,fg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},gg=new vi({side:p,depthWrite:!1,depthTest:!1}),xg=new os(new cs,gg),vg=new lm,{_lodPlanes:yg,_sizeLods:_g,_sigmas:bg}=Cg(),wg=new xi;let Mg=null;const Sg=(1+Math.sqrt(5))/2,Tg=1/Sg,Eg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Sg,Tg),new Yn(0,Sg,-Tg),new Yn(Tg,0,Sg),new Yn(-Tg,0,Sg),new Yn(Sg,Tg,0),new Yn(-Sg,Tg,0)];function Ag(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Lg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Ig(mg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Mg=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ng(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?ug:0,ug,ug),a.setRenderTarget(r),u&&a.render(xg,i),a.render(t,i)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ng()):null==this._equirectShader&&(this._equirectShader=Bg());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new os(yg[0],r),s=r.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=fg[t.encoding],s.outputEncoding.value=fg[e.texture.encoding],Dg(e,0,0,3*ug,2*ug),n.setRenderTarget(e),n.render(i,vg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;rmg&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${mg}`);const f=[];let g=0;for(let v=0;vhg-cg?r-hg+cg:0),3*x,2*x),a.setRenderTarget(e),a.render(c,vg)}}function Rg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Cg(){const t=[],e=[],n=[];let r=hg;for(let i=0;ihg-cg?o=pg[i-hg+cg-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),x=new Float32Array(m*p*u),v=new Float32Array(f*p*u);for(let t=0;t2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*p*t),x.set(h,m*p*t);const i=[t,t,t,t,t,t];v.set(i,f*p*t)}const y=new ki;y.setAttribute("position",new bi(g,d)),y.setAttribute("uv",new bi(x,m)),y.setAttribute("faceIndex",new bi(v,f)),t.push(y),r>cg&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pg(t){const e=new jn(3*ug,3*ug,t);return e.texture.mapping=ot,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dg(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ig(t){const e=new Float32Array(t),n=new Yn(0,1,0);return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Og()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Bg(){const t=new On(1,1);return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Og()}\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Ng(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Og()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Fg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Og(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}exports.PMREMGenerator=Lg;const zg=0;exports.LineStrip=0;const Gg=1;exports.LinePieces=1;const Hg=0;exports.NoColors=0;const Ug=1;exports.FaceColors=1;const kg=2;function Vg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Wg(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function jg(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yu(t,e)}function qg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Oh(t)}function Xg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yu(t,e)}function Yg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Zg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Jg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Qg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Kg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new bi(t,e).setUsage(Mn)}function $g(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wi(t,e)}function tx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mi(t,e)}function ex(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function nx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ti(t,e)}function rx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ei(t,e)}function ix(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ai(t,e)}function sx(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Li(t,e)}function ox(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function ax(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Pi(t,e)}function lx(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new sg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Kf(t,e)}function hx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pu(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pu(new Dp(t.geometry),new ru({color:void 0!==e?e:16777215}))}function px(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pd(t)}function dx(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xd(t)}function mx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ws(t,n)}function fx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.VertexColors=2,yd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(yd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hd.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gm.extractUrlBase(t)},hd.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Sf.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Sf.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Sf.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sf.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Qn.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},dr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Af.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Fn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Fn.floorPowerOfTwo(t)},Fn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Fn.ceilPowerOfTwo(t)},zn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},zn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},zn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},zn.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wr.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},wr.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},wr.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},wr.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},wr.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},wr.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},wr.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},wr.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},wr.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},wr.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},wr.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},wr.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},wr.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},wr.prototype.makeFrustum=function(t,e,n,r,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,s)},wr.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Qr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Xn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Xn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},br.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},br.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},br.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},li.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},li.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},li.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},li.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},li.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},li.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),li.getBarycoord(t,e,n,r,i)},li.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),li.getNormal(t,e,n,r)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Sp(this,t)},On.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},On.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},On.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Yn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Yn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Yn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Yn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Yn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Yn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Yn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Yn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Yn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Wn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),os.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(os.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Uh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Qh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Xh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(yd.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),xs.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zd.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(bi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),bi.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},bi.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},bi.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ki.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ki.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new bi(arguments[1],arguments[2])))},ki.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ki.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ki.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ki.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ki.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ki.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(xm.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(vf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(_h.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),_h.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},_h.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},gp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},gp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},yh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(ff.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(hi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(zp.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Op.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(fs.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),fh.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},fh.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},fh.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},fh.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},fh.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},fh.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},fh.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},fh.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},fh.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},fh.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},fh.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},fh.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},fh.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},fh.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},fh.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},fh.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},fh.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},fh.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},fh.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},fh.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},fh.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},fh.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},fh.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},fh.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},fh.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(fh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(jm.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Dm).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_s.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},_s.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new vd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new gd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126"); },{}],"xTGv":[function(require,module,exports) { @@ -539,21 +539,21 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"../../../build/three.module.js":"dKqR"}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"uNJb":[function(require,module,exports) { "use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(n){switch(t(n)){case"number":return 8;case"string":return 2*n.length;case"boolean":return 4;default:return 0}}function e(t){return/(Uint|Int|Float)(8|16|32)Array/.test(t.constructor.name)}function r(t,n){var e={total:0,depth:{min:1/0,max:-1/0},tris:{min:1/0,max:-1/0},splits:[0,0,0]};return t.traverse(function(t,n,r,o,i){e.total++,n?(e.depth.min=Math.min(t,e.depth.min),e.depth.max=Math.max(t,e.depth.max),e.tris.min=Math.min(i,e.tris.min),e.tris.max=Math.max(i,e.tris.max)):e.splits[o]++},n),e.tris.min===1/0&&(e.tris.min=0,e.tris.max=0),e.depth.min===1/0&&(e.depth.min=0,e.depth.max=0),e}function o(t){return t._roots.map(function(n,e){return r(t,e)})}function i(r){for(var o=new Set,i=[r],a=0;i.length;){var s=i.pop();if(!o.has(s))for(var m in o.add(s),s)if(s.hasOwnProperty(m)){a+=n(m);var u=s[m];!u||"object"!==t(u)&&"function"!=typeof u?a+=n(u):e(u)?a+=u.byteLength:u instanceof ArrayBuffer?a+=u.byteLength:i.push(u)}}return a}Object.defineProperty(exports,"__esModule",{value:!0}),exports.estimateMemoryInBytes=i,exports.getBVHExtremes=o; },{}],"HxoX":[function(require,module,exports) { @@ -575,6 +575,9 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{"three":"dKqR","./MeshBVH.js":"nIyY","./MeshBVHVisualizer.js":"jNwr","./Constants.js":"tuIt","./Utils/Debug.js":"uNJb","./MeshBVHDebug.js":"HxoX"}],"cgxr":[function(require,module,exports) { var define; var r;!function(){"use strict";var t=.5*(Math.sqrt(3)-1),e=(3-Math.sqrt(3))/6,a=1/6,o=(Math.sqrt(5)-1)/4,i=(5-Math.sqrt(5))/20;function n(r){var t;t="function"==typeof r?r:r?function(){var r=0,t=0,e=0,a=1,o=(i=4022871197,function(r){r=r.toString();for(var t=0;t>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i)}return 2.3283064365386963e-10*(i>>>0)});var i;r=o(" "),t=o(" "),e=o(" ");for(var n=0;nc?(o=1,i=0):(o=0,i=1);var y=m-o+e,w=c-i+e,g=m-1+2*e,A=c-1+2*e,x=255&d,q=255&p,D=.5-m*m-c*c;if(D>=0){var S=3*n[x+f[q]];s=(D*=D)*D*(v[S]*m+v[S+1]*c)}var U=.5-y*y-w*w;if(U>=0){var b=3*n[x+o+f[q+i]];h=(U*=U)*U*(v[b]*y+v[b+1]*w)}var F=.5-g*g-A*A;if(F>=0){var N=3*n[x+1+f[q+1]];l=(F*=F)*F*(v[N]*g+v[N+1]*A)}return 70*(s+h+l)},noise3D:function(r,t,e){var o,i,n,f,v,s,h,l,u,d,p=this.permMod12,M=this.perm,m=this.grad3,c=(r+t+e)*(1/3),y=Math.floor(r+c),w=Math.floor(t+c),g=Math.floor(e+c),A=(y+w+g)*a,x=r-(y-A),q=t-(w-A),D=e-(g-A);x>=q?q>=D?(v=1,s=0,h=0,l=1,u=1,d=0):x>=D?(v=1,s=0,h=0,l=1,u=0,d=1):(v=0,s=0,h=1,l=1,u=0,d=1):qT?k++:z++,P>_?k++:B++,P>j?k++:E++,T>_?z++:B++,T>j?z++:E++,_>j?B++:E++;var G=P-(l=k>=3?1:0)+i,H=T-(u=z>=3?1:0)+i,I=_-(d=B>=3?1:0)+i,J=j-(p=E>=3?1:0)+i,K=P-(M=k>=2?1:0)+2*i,L=T-(m=z>=2?1:0)+2*i,O=_-(c=B>=2?1:0)+2*i,Q=j-(y=E>=2?1:0)+2*i,R=P-(w=k>=1?1:0)+3*i,V=T-(g=z>=1?1:0)+3*i,W=_-(A=B>=1?1:0)+3*i,X=j-(x=E>=1?1:0)+3*i,Y=P-1+4*i,Z=T-1+4*i,$=_-1+4*i,rr=j-1+4*i,tr=255&U,er=255&b,ar=255&F,or=255&N,ir=.6-P*P-T*T-_*_-j*j;if(ir<0)n=0;else{var nr=q[tr+q[er+q[ar+q[or]]]]%32*4;n=(ir*=ir)*ir*(D[nr]*P+D[nr+1]*T+D[nr+2]*_+D[nr+3]*j)}var fr=.6-G*G-H*H-I*I-J*J;if(fr<0)f=0;else{var vr=q[tr+l+q[er+u+q[ar+d+q[or+p]]]]%32*4;f=(fr*=fr)*fr*(D[vr]*G+D[vr+1]*H+D[vr+2]*I+D[vr+3]*J)}var sr=.6-K*K-L*L-O*O-Q*Q;if(sr<0)v=0;else{var hr=q[tr+M+q[er+m+q[ar+c+q[or+y]]]]%32*4;v=(sr*=sr)*sr*(D[hr]*K+D[hr+1]*L+D[hr+2]*O+D[hr+3]*Q)}var lr=.6-R*R-V*V-W*W-X*X;if(lr<0)s=0;else{var ur=q[tr+w+q[er+g+q[ar+A+q[or+x]]]]%32*4;s=(lr*=lr)*lr*(D[ur]*R+D[ur+1]*V+D[ur+2]*W+D[ur+3]*X)}var dr=.6-Y*Y-Z*Z-$*$-rr*rr;if(dr<0)h=0;else{var pr=q[tr+1+q[er+1+q[ar+1+q[or+1]]]]%32*4;h=(dr*=dr)*dr*(D[pr]*Y+D[pr+1]*Z+D[pr+2]*$+D[pr+3]*rr)}return 27*(n+f+v+s+h)}},n._buildPermutationTable=f,void 0!==r&&r.amd&&r(function(){return n}),"undefined"!=typeof exports?exports.SimplexNoise=n:"undefined"!=typeof window&&(window.SimplexNoise=n),"undefined"!=typeof module&&(module.exports=n)}(); +},{}],"QVnC":[function(require,module,exports) { +var define; +var t,r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(P){u=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof d?r:d,i=Object.create(o.prototype),a=new G(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return F()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=j(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:s,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(P){return{type:"throw",arg:P}}}t.wrap=h;var l="suspendedStart",s="suspendedYield",p="executing",y="completed",v={};function d(){}function g(){}function m(){}var w={};w[i]=function(){return this};var L=Object.getPrototypeOf,x=L&&L(L(N([])));x&&x!==e&&n.call(x,i)&&(w=x);var b=m.prototype=d.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(r){u(t,r,function(t){return this._invoke(r,t)})})}function _(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(l).then(function(t){h.value=t,a(h)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function j(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} },{}],"g6Fz":[function(require,module,exports) { -"use strict";require("core-js/modules/es6.array.copy-within"),require("core-js/modules/es6.array.fill"),require("core-js/modules/es6.array.find"),require("core-js/modules/es6.array.find-index"),require("core-js/modules/es7.array.flat-map"),require("core-js/modules/es6.array.from"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.array.iterator"),require("core-js/modules/es6.array.of"),require("core-js/modules/es6.array.sort"),require("core-js/modules/es6.array.species"),require("core-js/modules/es6.date.to-json"),require("core-js/modules/es6.date.to-primitive"),require("core-js/modules/es6.function.has-instance"),require("core-js/modules/es6.function.name"),require("core-js/modules/es6.map"),require("core-js/modules/es6.math.acosh"),require("core-js/modules/es6.math.asinh"),require("core-js/modules/es6.math.atanh"),require("core-js/modules/es6.math.cbrt"),require("core-js/modules/es6.math.clz32"),require("core-js/modules/es6.math.cosh"),require("core-js/modules/es6.math.expm1"),require("core-js/modules/es6.math.fround"),require("core-js/modules/es6.math.hypot"),require("core-js/modules/es6.math.imul"),require("core-js/modules/es6.math.log1p"),require("core-js/modules/es6.math.log10"),require("core-js/modules/es6.math.log2"),require("core-js/modules/es6.math.sign"),require("core-js/modules/es6.math.sinh"),require("core-js/modules/es6.math.tanh"),require("core-js/modules/es6.math.trunc"),require("core-js/modules/es6.number.constructor"),require("core-js/modules/es6.number.epsilon"),require("core-js/modules/es6.number.is-finite"),require("core-js/modules/es6.number.is-integer"),require("core-js/modules/es6.number.is-nan"),require("core-js/modules/es6.number.is-safe-integer"),require("core-js/modules/es6.number.max-safe-integer"),require("core-js/modules/es6.number.min-safe-integer"),require("core-js/modules/es6.number.parse-float"),require("core-js/modules/es6.number.parse-int"),require("core-js/modules/es6.object.assign"),require("core-js/modules/es7.object.define-getter"),require("core-js/modules/es7.object.define-setter"),require("core-js/modules/es7.object.entries"),require("core-js/modules/es6.object.freeze"),require("core-js/modules/es6.object.get-own-property-descriptor"),require("core-js/modules/es7.object.get-own-property-descriptors"),require("core-js/modules/es6.object.get-own-property-names"),require("core-js/modules/es6.object.get-prototype-of"),require("core-js/modules/es7.object.lookup-getter"),require("core-js/modules/es7.object.lookup-setter"),require("core-js/modules/es6.object.prevent-extensions"),require("core-js/modules/es6.object.to-string"),require("core-js/modules/es6.object.is"),require("core-js/modules/es6.object.is-frozen"),require("core-js/modules/es6.object.is-sealed"),require("core-js/modules/es6.object.is-extensible"),require("core-js/modules/es6.object.keys"),require("core-js/modules/es6.object.seal"),require("core-js/modules/es6.object.set-prototype-of"),require("core-js/modules/es7.object.values"),require("core-js/modules/es6.promise"),require("core-js/modules/es7.promise.finally"),require("core-js/modules/es6.reflect.apply"),require("core-js/modules/es6.reflect.construct"),require("core-js/modules/es6.reflect.define-property"),require("core-js/modules/es6.reflect.delete-property"),require("core-js/modules/es6.reflect.get"),require("core-js/modules/es6.reflect.get-own-property-descriptor"),require("core-js/modules/es6.reflect.get-prototype-of"),require("core-js/modules/es6.reflect.has"),require("core-js/modules/es6.reflect.is-extensible"),require("core-js/modules/es6.reflect.own-keys"),require("core-js/modules/es6.reflect.prevent-extensions"),require("core-js/modules/es6.reflect.set"),require("core-js/modules/es6.reflect.set-prototype-of"),require("core-js/modules/es6.regexp.constructor"),require("core-js/modules/es6.regexp.flags"),require("core-js/modules/es6.regexp.match"),require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es6.regexp.split"),require("core-js/modules/es6.regexp.search"),require("core-js/modules/es6.regexp.to-string"),require("core-js/modules/es6.set"),require("core-js/modules/es6.symbol"),require("core-js/modules/es7.symbol.async-iterator"),require("core-js/modules/es6.string.anchor"),require("core-js/modules/es6.string.big"),require("core-js/modules/es6.string.blink"),require("core-js/modules/es6.string.bold"),require("core-js/modules/es6.string.code-point-at"),require("core-js/modules/es6.string.ends-with"),require("core-js/modules/es6.string.fixed"),require("core-js/modules/es6.string.fontcolor"),require("core-js/modules/es6.string.fontsize"),require("core-js/modules/es6.string.from-code-point"),require("core-js/modules/es6.string.includes"),require("core-js/modules/es6.string.italics"),require("core-js/modules/es6.string.iterator"),require("core-js/modules/es6.string.link"),require("core-js/modules/es7.string.pad-start"),require("core-js/modules/es7.string.pad-end"),require("core-js/modules/es6.string.raw"),require("core-js/modules/es6.string.repeat"),require("core-js/modules/es6.string.small"),require("core-js/modules/es6.string.starts-with"),require("core-js/modules/es6.string.strike"),require("core-js/modules/es6.string.sub"),require("core-js/modules/es6.string.sup"),require("core-js/modules/es7.string.trim-left"),require("core-js/modules/es7.string.trim-right"),require("core-js/modules/es6.typed.array-buffer"),require("core-js/modules/es6.typed.int8-array"),require("core-js/modules/es6.typed.uint8-array"),require("core-js/modules/es6.typed.uint8-clamped-array"),require("core-js/modules/es6.typed.int16-array"),require("core-js/modules/es6.typed.uint16-array"),require("core-js/modules/es6.typed.int32-array"),require("core-js/modules/es6.typed.uint32-array"),require("core-js/modules/es6.typed.float32-array"),require("core-js/modules/es6.typed.float64-array"),require("core-js/modules/es6.weak-map"),require("core-js/modules/es6.weak-set"),require("core-js/modules/web.timers"),require("core-js/modules/web.immediate"),require("core-js/modules/web.dom.iterable"),require("regenerator-runtime/runtime");var e=c(require("stats.js/src/Stats")),r=l(require("dat.gui")),s=l(require("three")),o=require("three/examples/jsm/controls/OrbitControls.js"),t=require("three/examples/jsm/controls/TransformControls.js"),i=require("three/examples/jsm/objects/MarchingCubes.js"),n=c(require("../src/MeshBVHVisualizer.js")),a=require("../src/index.js"),u=c(require("simplex-noise"));function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function l(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d();if(r&&r.has(e))return r.get(e);var s={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=o?Object.getOwnPropertyDescriptor(e,t):null;i&&(i.get||i.set)?Object.defineProperty(s,t,i):s[t]=e[t]}return s.default=e,r&&r.set(e,s),s}function c(e){return e&&e.__esModule?e:{default:e}}var m=regeneratorRuntime.mark(I);s.Mesh.prototype.raycast=a.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=a.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=a.disposeBoundsTree;var p,j,q,h,f,y,g,w,b,v,x,M,S,B,k,C,P,z={visualizeBounds:!1,visualBoundsDepth:10,volume:{display:1,hideWhileGenerating:!1,alwaysShowDistance:!0,surfaceOnly:!1,distance:1,resolution:100,radius:4},displayClosestPoint:!0},W=!1;function G(){(h=new s.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),h.setSize(window.innerWidth,window.innerHeight),h.setClearColor(1251612,1),h.shadowMap.enabled=!0,h.shadowMap.type=s.PCFSoftShadowMap,document.body.appendChild(h.domElement),(j=new s.Scene).fog=new s.Fog(1251612,10,45);var n=new s.DirectionalLight(16777215,.5);n.position.set(20,20,20),n.castShadow=!0,n.shadow.mapSize.set(2048,2048);var a=n.shadow.camera;a.left=a.bottom=-15,a.right=a.top=15,a.updateProjectionMatrix(),j.add(n),j.add(new s.AmbientLight(14743546,.5));for(var d=new s.PlaneBufferGeometry(50,50,249,249),l=d.attributes.position,c=~~(100*Math.random()),m=new u.default(c),y=0;y<62500;y++){var G=l.getX(y)/15,T=l.getY(y)/15;l.setZ(y,3*m.noise2D(G,T))}d.computeVertexNormals(),d.computeBoundsTree({lazyGeneration:!1}),(g=new s.Mesh(d,new s.MeshStandardMaterial({color:16777215,metalness:.1,roughness:.9,side:s.DoubleSide}))).rotation.x=-Math.PI/2,g.position.y=-3,g.receiveShadow=!0,j.add(g),(q=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.z=5,q.far=100,q.updateProjectionMatrix(),p=new e.default,document.body.appendChild(p.dom);var I=new s.MeshStandardMaterial({roughness:.75,metalness:.1});w=new s.Group,j.add(w),(b=new s.Mesh(new s.CylinderBufferGeometry(.5,.25,1,20,1),I)).castShadow=!0,b.receiveShadow=!0,b.geometry.computeBoundsTree(),b.geometry.computeBoundingSphere(),w.add(b),f=new o.OrbitControls(q,h.domElement),(v=new t.TransformControls(q,h.domElement)).attach(w),v.addEventListener("dragging-changed",function(e){f.enabled=!e.value,e.value||(W=!0)}),v.addEventListener("objectChange",function(e){W=!0}),j.add(v);var E=new s.MeshStandardMaterial({color:15277667,metalness:0,roughness:.9,side:s.DoubleSide});(x=new i.MarchingCubes(100,E,!1,!1)).isolation=0;var A=new s.MeshStandardMaterial({flatShading:!0,color:15277667,metalness:0,roughness:.35,transparent:!0,depthWrite:!1,opacity:.15,premultipliedAlpha:!0});(M=new s.Mesh(void 0,A)).visible=!1,M.receiveShadow=!0;var F=A.clone();F.side=s.BackSide,(S=new s.Mesh(void 0,F)).receiveShadow=!0,S.visible=!1,(B=new s.Group).scale.multiplyScalar(5),B.add(x),B.add(S),B.add(M),j.add(B),(k=new s.Mesh(new s.SphereBufferGeometry(.025,20,20),new s.MeshBasicMaterial({color:15277667}))).castShadow=!0,j.add(k),(C=k.clone()).castShadow=!0,j.add(C);var R=new s.Mesh(new s.BoxBufferGeometry,k.material);R.castShadow=!0,R.position.z=.5,(P=new s.Object3D).add(R),j.add(P),j.updateMatrixWorld(!0);var H=new r.GUI({width:300});H.add(z,"visualizeBounds").onChange(function(){return O()}),H.add(z,"visualBoundsDepth").min(1).max(40).step(1).onChange(function(){return O()});var V=H.addFolder("distanceVisualization");V.add(z.volume,"display",{hide:0,"distance to terrain":1,"distance to mesh":2}).onChange(function(){return L=!0}),V.add(z.volume,"hideWhileGenerating"),V.add(z.volume,"alwaysShowDistance"),V.add(z.volume,"surfaceOnly").onChange(function(){return L=!0}),V.add(z.volume,"distance").min(0).max(2).step(.01).onChange(function(){return L=!0}),V.add(z.volume,"radius").min(1).max(20).onChange(function(){return L=!0}),V.add(z.volume,"resolution",5,200,1).onChange(function(){return L=!0}),V.open(),H.add(v,"mode",["translate","rotate"]);var _=H.addFolder("position");_.add(w.position,"x").min(-5).max(5).step(.001).listen(),_.add(w.position,"y").min(-5).max(5).step(.001).listen(),_.add(w.position,"z").min(-5).max(5).step(.001).listen();var N=H.addFolder("rotation");N.add(w.rotation,"x").min(-Math.PI).max(Math.PI).step(.001).listen(),N.add(w.rotation,"y").min(-Math.PI).max(Math.PI).step(.001).listen(),N.add(w.rotation,"z").min(-Math.PI).max(Math.PI).step(.001).listen(),H.open(),D(),window.addEventListener("resize",function(){q.aspect=window.innerWidth/window.innerHeight,q.updateProjectionMatrix(),h.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("keydown",function(e){switch(e.key){case"w":v.mode="translate";break;case"e":v.mode="rotate"}H.updateDisplay()})}function O(){y&&!z.visualizeBounds&&(j.remove(y),y=null),!y&&z.visualizeBounds&&(y=new n.default(g),j.add(y)),y&&(y.depth=z.visualBoundsDepth)}function D(e){w.updateMatrixWorld();var r=(new s.Matrix4).copy(g.matrixWorld).invert().multiply(w.matrixWorld),o=z.volume.distance,t=o,i=e?o:0,n=g.geometry.boundsTree.closestPointToGeometry(g,b.geometry,r,k.position,C.position,i,t)THREE.js BVH Geometry Closest Distance
- \ No newline at end of file +THREE.js BVH Geometry Closest Distance
\ No newline at end of file diff --git a/example/bundle/generateAsync.worker.13d14241.js b/example/bundle/generateAsync.worker.13d14241.js index bb95c3e7c..078a2e68b 100644 --- a/example/bundle/generateAsync.worker.13d14241.js +++ b/example/bundle/generateAsync.worker.13d14241.js @@ -7,15 +7,15 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"HHJX":[function(require,module,exports) { var global = arguments[3]; var e=arguments[3],r=require("three"),t=i(require("../MeshBVH.js"));function i(e){return e&&e.__esModule?e:{default:e}}e.onmessage=function(i){var n=i.data,s=n.index,u=n.position,a=n.options;try{var o=new r.BufferGeometry;o.setAttribute("position",new r.BufferAttribute(u,3,!1)),s&&o.setIndex(new r.BufferAttribute(s,1,!1)),a.lazyGeneration=!1;var f=new t.default(o,a),l=t.default.serialize(f,o,!1);e.postMessage({error:null,serialized:l,position:u},[l.index.buffer,u.buffer])}catch(d){e.postMessage({error:d,serialized:null})}}; diff --git a/example/bundle/physics.50b811f1.js b/example/bundle/physics.50b811f1.js index ca5937cc2..1e6fc973e 100644 --- a/example/bundle/physics.50b811f1.js +++ b/example/bundle/physics.50b811f1.js @@ -10,7 +10,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var define; var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof e&&e.amd?e(n):t.Stats=n()}(this,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;to+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var l=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,s=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,s,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p,u,s,m),{dom:h,update:function(f,y){l=Math.min(l,f),i=Math.max(i,f),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(a(f)+" "+e+" ("+a(l)+"-"+a(i)+")",c,d),v.drawImage(h,p+o,u,s-o,m,p,u,s-o,m),v.fillRect(p+s-o,u,o,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p+s-o,u,o,a((1-f/y)*m))}}},e}); },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"tuIt":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CONTAINED=exports.INTERSECTED=exports.NOT_INTERSECTED=exports.SAH=exports.AVERAGE=exports.CENTER=void 0;var r=0;exports.CENTER=r;var E=1;exports.AVERAGE=E;var e=2;exports.SAH=e;var t=0;exports.NOT_INTERSECTED=t;var o=1;exports.INTERSECTED=o;var s=2;exports.CONTAINED=s; },{}],"qYFu":[function(require,module,exports) { @@ -18,15 +18,15 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i2)){c.x=e.clientX/window.innerWidth*2-1,c.y=-e.clientY/window.innerHeight*2+1,s.setFromCamera(c,p);var t=B();t.position.copy(p.position).addScaledVector(s.ray.direction,3),t.velocity.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).addScaledVector(s.ray.direction,10*Math.random()+15).multiplyScalar(.5)}}),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.createSphere=B}function z(){(new t.GLTFLoader).load("../models/low_poly_environment_jungle_scene/scene.gltf",function(t){(f=t.scene).scale.setScalar(.05);var a=new e.PointLight(65535);a.distance=7,a.position.set(-100,-40,100),f.add(a);var i=new e.PointLight(16768358);i.distance=15,i.intensity=5,i.position.set(80,80,135),i.shadow.normalBias=.01,i.shadow.bias=-.001,i.shadow.mapSize.setScalar(1024),i.castShadow=!0,f.add(i);var o=[];f.updateMatrixWorld(!0),f.traverse(function(e){if(e.geometry){var t=e.geometry.clone();for(var a in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==a&&t.deleteAttribute(a);o.push(t)}});var d=r.BufferGeometryUtils.mergeBufferGeometries(o,!1);d.boundsTree=new n.MeshBVH(d,{lazyGeneration:!1}),(w=new e.Mesh(d)).material.wireframe=!0,w.material.opacity=.5,w.material.transparent=!0,y=new n.MeshBVHVisualizer(w,S.visualizeDepth),u.add(y),u.add(w),u.add(f),f.traverse(function(e){e.material&&(e.castShadow=!0,e.receiveShadow=!0,e.material.shadowSide=2)})})}function C(t,a,r,i,o){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(oG.dot(v.velocity)?(F=.5*H*(W-E)/(W+E),q=.5*H*2*W/(W+E),F-=H):(F=.5*H*2*E/(W+E),q=.5*H*(E-W)/(W+E),q-=H),G.normalize(),p.velocity.addScaledVector(G,F),v.velocity.addScaledVector(G,q),x.copy(h.center).addScaledVector(b,-h.radius),C(p,v,x,b,H,0)}}p.position.copy(h.center)}}function O(){g.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),g.length=0,M.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),M.length=0}function G(){var t=new e.Vector3;g.forEach(function(e){t.copy(e.position),t.y+=10,t.normalize(),e.velocity.addScaledVector(t,120)})}function H(e){if(w)for(var t=S.physicsSteps,a=0;a=1&&(M.splice(r,1),o.parent.remove(o),o.geometry.dispose(),o.material.dispose(),r--,i--)}}function W(){v.update(),requestAnimationFrame(W);var e=Math.min(h.getDelta(),.1);w&&(w.visible=S.displayCollider,y.visible=S.displayBVH,S.pause||H(S.simulationSpeed*e)),l.render(u,p)}j(),W(); +"use strict";var e=c(require("three")),t=require("three/examples/jsm/loaders/GLTFLoader.js"),a=require("three/examples/jsm/controls/OrbitControls.js"),r=require("three/examples/jsm/utils/BufferGeometryUtils.js"),i=d(require("stats.js")),o=require("dat.gui"),n=require("../src/index.js");function d(e){return e&&e.__esModule?e:{default:e}}function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,a=new WeakMap;return(s=function(e){return e?a:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=s(t);if(a&&a.has(e))return a.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var n=i?Object.getOwnPropertyDescriptor(e,o):null;n&&(n.get||n.set)?Object.defineProperty(r,o,n):r[o]=e[o]}return r.default=e,a&&a.set(e,r),r}var l,p,u,h,m,v,f,w,y,S={displayCollider:!1,displayBVH:!1,visualizeDepth:10,gravity:-9.8,physicsSteps:5,simulationSpeed:1,sphereSize:1,pause:!1,step:function(){for(var e=S.physicsSteps,t=0;t2)){c.x=e.clientX/window.innerWidth*2-1,c.y=-e.clientY/window.innerHeight*2+1,s.setFromCamera(c,p);var t=B();t.position.copy(p.position).addScaledVector(s.ray.direction,3),t.velocity.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).addScaledVector(s.ray.direction,10*Math.random()+15).multiplyScalar(.5)}}),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.createSphere=B}function z(){(new t.GLTFLoader).load("../models/low_poly_environment_jungle_scene/scene.gltf",function(t){(f=t.scene).scale.setScalar(.05);var a=new e.PointLight(65535);a.distance=7,a.position.set(-100,-40,100),f.add(a);var i=new e.PointLight(16768358);i.distance=15,i.intensity=5,i.position.set(80,80,135),i.shadow.normalBias=.01,i.shadow.bias=-.001,i.shadow.mapSize.setScalar(1024),i.castShadow=!0,f.add(i);var o=[];f.updateMatrixWorld(!0),f.traverse(function(e){if(e.geometry){var t=e.geometry.clone();for(var a in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==a&&t.deleteAttribute(a);o.push(t)}});var d=r.BufferGeometryUtils.mergeBufferGeometries(o,!1);d.boundsTree=new n.MeshBVH(d,{lazyGeneration:!1}),(w=new e.Mesh(d)).material.wireframe=!0,w.material.opacity=.5,w.material.transparent=!0,y=new n.MeshBVHVisualizer(w,S.visualizeDepth),u.add(y),u.add(w),u.add(f),f.traverse(function(e){e.material&&(e.castShadow=!0,e.receiveShadow=!0,e.material.shadowSide=2)})})}function C(t,a,r,i,o){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(oW.dot(v.velocity)?(F=.5*G*(H-E)/(H+E),q=.5*G*2*H/(H+E),F-=G):(F=.5*G*2*E/(H+E),q=.5*G*(E-H)/(H+E),q-=G),W.normalize(),p.velocity.addScaledVector(W,F),v.velocity.addScaledVector(W,q),x.copy(h.center).addScaledVector(b,-h.radius),C(p,v,x,b,G,0)}}p.position.copy(h.center)}}function O(){M.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),M.length=0,g.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),g.length=0}function W(){var t=new e.Vector3;M.forEach(function(e){t.copy(e.position),t.y+=10,t.normalize(),e.velocity.addScaledVector(t,120)})}function G(e){if(w)for(var t=S.physicsSteps,a=0;a=1&&(g.splice(r,1),o.parent.remove(o),o.geometry.dispose(),o.material.dispose(),r--,i--)}}function H(){v.update(),requestAnimationFrame(H);var e=Math.min(h.getDelta(),.1);w&&(w.visible=S.displayCollider,y.visible=S.displayBVH,S.pause||G(S.simulationSpeed*e)),l.render(u,p)}j(),H(); },{"three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","stats.js":"dnrf","dat.gui":"KkZG","../src/index.js":"uBxZ"}]},{},["UoLN"], null) \ No newline at end of file diff --git a/example/bundle/pointCloudIntersection.fd058085.js b/example/bundle/pointCloudIntersection.fd058085.js index 1e8394229..b6d67be15 100644 --- a/example/bundle/pointCloudIntersection.fd058085.js +++ b/example/bundle/pointCloudIntersection.fd058085.js @@ -7,7 +7,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"../../../build/three.module.js":"dKqR"}],"FLQP":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PLYLoader=void 0;var e=require("../../../build/three.module.js"),t=function(t){e.Loader.call(this,t),this.propertyNameMapping={}};exports.PLYLoader=t,t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,r,n,s){var a=this,i=new e.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(t,function(e){try{r(a.parse(e))}catch(n){s?s(n):console.error(n),a.manager.itemError(t)}},n,s)},setPropertyNameMapping:function(e){this.propertyNameMapping=e},parse:function(t){function r(e){var t="",r=0,n=/ply([\s\S]*)end_header\r?\n/.exec(e);null!==n&&(t=n[1],r=new Blob([n[0]]).size);var s,a,i,o,c,u,l={comments:[],elements:[],headerLength:r,objInfo:""},f=t.split("\n");for(var h=0;h=t.elements[u].count&&(u++,l=0);var h=s(t.elements[u].properties,f);o(n,t.elements[u].name,h),l++}}return i(n)}function i(t){var r=new e.BufferGeometry;return t.indices.length>0&&r.setIndex(t.indices),r.setAttribute("position",new e.Float32BufferAttribute(t.vertices,3)),t.normals.length>0&&r.setAttribute("normal",new e.Float32BufferAttribute(t.normals,3)),t.uvs.length>0&&r.setAttribute("uv",new e.Float32BufferAttribute(t.uvs,2)),t.colors.length>0&&r.setAttribute("color",new e.Float32BufferAttribute(t.colors,3)),t.faceVertexUvs.length>0&&(r=r.toNonIndexed()).setAttribute("uv",new e.Float32BufferAttribute(t.faceVertexUvs,2)),r.computeBoundingSphere(),r}function o(e,t,r){if("vertex"===t)e.vertices.push(r.x,r.y,r.z),"nx"in r&&"ny"in r&&"nz"in r&&e.normals.push(r.nx,r.ny,r.nz),"s"in r&&"t"in r&&e.uvs.push(r.s,r.t),"red"in r&&"green"in r&&"blue"in r&&e.colors.push(r.red/255,r.green/255,r.blue/255);else if("face"===t){var n=r.vertex_indices||r.vertex_index,s=r.texcoord;3===n.length?(e.indices.push(n[0],n[1],n[2]),s&&6===s.length&&(e.faceVertexUvs.push(s[0],s[1]),e.faceVertexUvs.push(s[2],s[3]),e.faceVertexUvs.push(s[4],s[5]))):4===n.length&&(e.indices.push(n[0],n[1],n[3]),e.indices.push(n[1],n[2],n[3]))}}function c(e,t,r,n){switch(r){case"int8":case"char":return[e.getInt8(t),1];case"uint8":case"uchar":return[e.getUint8(t),1];case"int16":case"short":return[e.getInt16(t,n),2];case"uint16":case"ushort":return[e.getUint16(t,n),2];case"int32":case"int":return[e.getInt32(t,n),4];case"uint32":case"uint":return[e.getUint32(t,n),4];case"float32":case"float":return[e.getFloat32(t,n),4];case"float64":case"double":return[e.getFloat64(t,n),8]}}function u(e,t,r,n){for(var s,a={},i=0,o=0;o=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"tuIt":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CONTAINED=exports.INTERSECTED=exports.NOT_INTERSECTED=exports.SAH=exports.AVERAGE=exports.CENTER=void 0;var r=0;exports.CENTER=r;var E=1;exports.AVERAGE=E;var e=2;exports.SAH=e;var t=0;exports.NOT_INTERSECTED=t;var o=1;exports.INTERSECTED=o;var s=2;exports.CONTAINED=s; },{}],"qYFu":[function(require,module,exports) { @@ -15,29 +15,29 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=w;var n=require("three"),r=o(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function o(n){return n&&n.__esModule?n:{default:n}}function a(n,r){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=i(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=n[Symbol.iterator]()},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function i(n,r){if(n){if("string"==typeof n)return u(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,r):void 0}}function u(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t65535?Uint32Array:Uint16Array)(t);r.setIndex(new n.BufferAttribute(e,1));for(var o=0;o4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,i=1/0,u=1/0,f=-1/0,l=-1/0,s=-1/0,c=1/0,v=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,x=null!==o,b=6*r,p=6*(r+t);bf&&(f=B),x&&wg&&(g=w);var D=n[b+2],S=n[b+3],E=D-S,M=D+S;El&&(l=M),x&&Dy&&(y=D);var j=n[b+4],T=n[b+5],F=j-T,G=j+T;Fs&&(s=G),x&&jh&&(h=j)}e[0]=a,e[1]=i,e[2]=u,e[3]=f,e[4]=l,e[5]=s,x&&(o[0]=c,o[1]=v,o[2]=d,o[3]=g,o[4]=y,o[5]=h)}function g(n,r,t,e){for(var o=1/0,a=1/0,i=1/0,u=-1/0,f=-1/0,l=-1/0,s=6*r,c=6*(r+t);su&&(u=v);var d=n[s+2];df&&(f=d);var g=n[s+4];gl&&(l=g)}e[0]=o,e[1]=a,e[2]=i,e[3]=u,e[4]=f,e[5]=l}function y(n,r,t,e,o,a){for(var i=e,u=e+o-1,f=a.pos,l=2*a.axis;;){for(;i<=u&&r[6*i+l]=f;)u--;if(!(ix&&(x=g),y>x&&(x=y);var b=(x-h)/2,p=2*v;o[u+p+0]=h+b,o[u+p+1]=b+(Math.abs(h)+b)*f}return o}function w(o,i){function u(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!S&&i>=w&&(S=!0,A&&(console.warn("MeshBVH: Max depth of ".concat(w," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,o))),e<=m||i>=w)return n.offset=t,n.count=e,n;var c=h(n.boundingData,a,l,s,t,e,B);if(-1===c.axis)return n.offset=t,n.count=e,n;var v=y(x,l,s,t,e,c);if(v===t||v===t+e)n.offset=t,n.count=e;else{n.splitAxis=c.axis;var b=new r.default,p=t,E=v-t;n.left=b,b.boundingData=new Float32Array(6),D?(d(l,p,E,b.boundingData),b.continueGeneration=function(){delete this.continueGeneration,g(l,p,E,f),u(b,p,E,f,i+1)}):(d(l,p,E,b.boundingData,f),u(b,p,E,f,i+1));var M=new r.default,j=v,T=e-E;n.right=M,M.boundingData=new Float32Array(6),D?(d(l,j,T,M.boundingData),M.continueGeneration=function(){delete this.continueGeneration,g(l,j,T,f),u(M,j,T,f,i+1)}):(d(l,j,T,M.boundingData,f),u(M,j,T,f,i+1))}return n}c(o);var f=new Float32Array(6),l=p(o),s=i.strategy===e.SAH?b(l):null,x=o.index.array,w=i.maxDepth,A=i.verbose,m=i.maxLeafTris,B=i.strategy,D=i.lazyGeneration,S=!1,E=[],M=v(o);if(1===M.length){var j=new r.default,T=M[0];null!=o.boundingBox?(j.boundingData=(0,t.boxToArray)(o.boundingBox),g(l,T.offset,T.count,f)):(j.boundingData=new Float32Array(6),d(l,T.offset,T.count,j.boundingData,f)),u(j,T.offset,T.count,f),E.push(j)}else{var F,G=a(M);try{for(G.s();!(F=G.n()).done;){var I=F.value,H=new r.default;H.boundingData=new Float32Array(6),d(l,I.offset,I.count,H.boundingData,f),u(H,I.offset,I.count,f),E.push(H)}}catch(V){G.e(V)}finally{G.f()}}if(null==o.boundingBox){var U=new n.Box3;o.boundingBox=new n.Box3;var q,z=a(E);try{for(z.s();!(q=z.n()).done;){var C=q.value;o.boundingBox.union((0,t.arrayToBox)(C.boundingData,U))}}catch(V){z.e(V)}finally{z.f()}}return E} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(xn.far?null:{distance:l,point:c.clone(),object:r}}function l(c,l,s,d,b,m,V,g){r.fromBufferAttribute(d,m),t.fromBufferAttribute(d,V),n.fromBufferAttribute(d,g);var w=f(c,c.material,l,s,r,t,n,a);if(w){b&&(i.fromBufferAttribute(b,m),o.fromBufferAttribute(b,V),u.fromBufferAttribute(b,g),w.uv=e.Triangle.getUV(a,r,t,n,i,o,u,new e.Vector2));var x={a:m,b:V,c:g,normal:new e.Vector3,materialIndex:0};e.Triangle.getNormal(r,t,n,x.normal),w.face=x,w.faceIndex=m}return w}function s(e,r,t,n,i,o){var u=3*i,a=r.index.getX(u),c=r.index.getX(u+1),f=r.index.getX(u+2),s=l(e,t,n,r.attributes.position,r.attributes.uv,a,c,f);return s?(s.faceIndex=i,o&&o.push(s),s):null} },{"three":"dKqR"}],"KhBA":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.intersectTris=r,exports.intersectClosestTri=t;var e=require("./ThreeIntersectionUtilities.js");function r(r,t,i,s,n,c,o){for(var u=n,a=n+c;u=0;x?(o=e.left,a=e.right):(o=e.right,a=e.left);var d=l(o,i,s)?g(o,n,r,i):null;if(d){var p=d.point[f];if(x?p<=a.boundingData[u]:p>=a.boundingData[u+3])return d}var v=l(a,i,s)?g(a,n,r,i):null;return d&&v?d.distance<=v.distance?d:v:d||v||null}var x=function(){var t=new o.SeparatingAxisTriangle,r=new e.Box3,u=new e.Box3;function s(e,t,n,r,o,a,u){for(var s=n.index,c=n.attributes.position,l=3*e,f=3*(t+e);l3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:t,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:r,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:u;function v(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.left).continueGeneration&&e.continueGeneration();return e.offset}function y(e){for(e.continueGeneration&&e.continueGeneration();!e.count;)(e=e.right).continueGeneration&&e.continueGeneration();return e.offset+e.count}if(i.continueGeneration&&i.continueGeneration(),!!i.count&&l){var T=o.geometry;return s(i.offset,i.count,T,l,!1,g,x)}var B,b,h,G,m=i.left,D=i.right,w=m,M=D;if(f&&(h=d,G=p,(0,n.arrayToBox)(w.boundingData,h),(0,n.arrayToBox)(M.boundingData,G),B=f(h),(b=f(G))4&&void 0!==arguments[4]?arguments[4]:null;if(r.continueGeneration&&r.continueGeneration(),null===d&&(g.boundingBox||g.computeBoundingBox(),l.set(g.boundingBox.min,g.boundingBox.max,x),l.update(),d=l),!!!r.count){var p=r.left,v=r.right;return(0,n.arrayToBox)(p.boundingData,u),d.intersectsBox(u)&&e(p,o,g,x,d)?!0:((0,n.arrayToBox)(v.boundingData,u),!(!d.intersectsBox(u)||!e(v,o,g,x,d)))}var y=o.geometry,T=y.index,B=y.attributes.position,b=g.index,h=g.attributes.position,G=r.offset,m=r.count;if(c.copy(x).invert(),g.boundsTree){(0,n.arrayToBox)(r.boundingData,f),f.matrix.copy(c),f.update(),s.geometry=g;var D=g.boundsTree.shapecast(s,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var t=3*G,n=3*(m+G);t=0;T?(x=e+8,v=p[e+6]):(x=p[e+6],v=e+8);var h=c(x,o,i,u)?f(x,t,n,i):null;if(h){var w=h.point[m];if(T?w<=o[v+B]:w>=o[v+B+3])return h}var b=c(v,o,i,u)?f(v,t,n,i):null;return h&&b?h.distance<=b.distance?h:b:h||b||null}var p=function(){var r=new i.SeparatingAxisTriangle,t=new e.Box3,o=new e.Box3;function u(e,r,t,i,a,o,u){for(var s=t.index,l=t.attributes.position,f=3*e,p=3*(r+e);f3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,x=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:t,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:o;function B(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e+=8);return n[e+6]}function m(e){for(var r=2*e,t=d,n=y;65535!==t[r+15];)r=2*(e=n[e+6]);return n[e+6]+t[r+14]}var T=2*n,w=g,b=d,A=y;if(!(65535!==b[T+15])&&l){var M=i.geometry;return u(A[n+6],b[T+14],M,l,!1,p,x)}var U,j,q,O,C=n+8,N=A[n+6],S=C,z=N;if(f&&(O=v,h(S,w,q=c),h(z,w,O),U=f(q),(j=f(O))4&&void 0!==arguments[4]?arguments[4]:null,v=2*t,B=g,m=d,T=y;if(null===c&&(p.boundingBox||p.computeBoundingBox(),l.set(p.boundingBox.min,p.boundingBox.max,x),l.update(),c=l),!!(65535!==m[v+15])){var w=t+8,b=T[t+6];return h(w,B,o),c.intersectsBox(o)&&e(w,i,p,x,c)?!0:(h(b,B,o),!(!c.intersectsBox(o)||!e(b,i,p,x,c)))}var A=i.geometry,M=A.index,U=A.attributes.position,j=p.index,q=p.attributes.position,O=T[t+6],C=m[v+14];if(s.copy(x).invert(),p.boundsTree){h(t,B,f),f.matrix.copy(s),f.update(),u.geometry=p;var N=p.boundsTree.shapecast(u,function(e){return f.intersectsBox(e)},function(e){e.a.applyMatrix4(x),e.b.applyMatrix4(x),e.c.applyMatrix4(x),e.update();for(var r=3*O,t=3*(C+O);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(i=Object.assign(c({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,lazyGeneration:!0,packData:!0},g,!1),i)).strategy=Math.max(0,Math.min(2,i.strategy)),this._isPacked=!1,this._roots=null,i[g]||(this._roots=(0,r.buildTree)(e,i),!i.lazyGeneration&&i.packData&&(this._roots=n.serialize(this,e,!1).roots,this._isPacked=!0))}return h(n,null,[{key:"serialize",value:function(e,t){var r,n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];function a(e){e.continueGeneration&&e.continueGeneration(),e.count||(a(e.left),a(e.right))}function s(e){return e.count?1:1+s(e.left)+s(e.right)}function u(e,t){for(var o=e/4,a=e/2,s=!!t.count,l=t.boundingData,f=0;f<6;f++)r[o+f]=l[f];if(s){var c=t.offset,d=t.count;return n[o+6]=c,i[a+14]=d,i[a+15]=p,e+y}var v,h=t.left,g=t.right,b=t.splitAxis;return v=u(e+y,h),n[o+6]=v/4,v=u(v,g),n[o+7]=b,v}var l,f=e._roots;if(e._isPacked)l=f;else{l=[];for(var c=0;c2&&void 0!==arguments[2])||arguments[2],o=t.index,a=t.roots,s=new n(r,c({},g,!0));if(s._roots=a,s._isPacked=!0,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==o&&(u.array.set(o),u.needsUpdate=!0)}return s}}]),h(n,[{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._isPacked){var r=this._roots[t],n=new Uint32Array(r),i=new Uint16Array(r);!function t(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*o,u=i[s+15];if(u){var l=n[o+6],f=i[s+14];e(a,u,new Float32Array(r,4*o,6),l,f)}else{var c=o+y/4,d=n[o+6],v=n[o+7];e(a,u,new Float32Array(r,4*o,6),v,!1)||(t(c,a+1),t(d,a+1))}}(0)}else{!function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=!!r.count;i?e(n,i,r.boundingData,r.offset,r.count):e(n,i,r.boundingData,r.splitAxis,!!r.continueGeneration)||(r.left&&t(r.left,n+1),r.right&&t(r.right,n+1))}(this._roots[t])}}},{key:"raycast",value:function(e,t,r,n){var i,o=this._isPacked,l=u(this._roots);try{for(l.s();!(i=l.n()).done;){var f=i.value;o?((0,s.setBuffer)(f),(0,s.raycastBuffer)(0,e,t,r,n)):(0,a.raycast)(f,e,t,r,n)}}catch(c){l.e(c)}finally{l.f()}o&&(0,s.clearBuffer)()}},{key:"raycastFirst",value:function(e,t,r){var n,i=this._isPacked,o=null,l=u(this._roots);try{for(l.s();!(n=l.n()).done;){var f=n.value,c=void 0;i?((0,s.setBuffer)(f),c=(0,s.raycastFirstBuffer)(0,e,t,r)):c=(0,a.raycastFirst)(f,e,t,r),null!=c&&(null==o||c.distance2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this._isPacked,l=!1,f=u(this._roots);try{for(f.s();!(r=f.n()).done;){var c=r.value;if(o?((0,s.setBuffer)(c),l=(0,s.shapecastBuffer)(0,e,t,n,i)):l=(0,a.shapecast)(c,e,t,n,i),l)break}}catch(d){f.e(d)}finally{f.f()}return o&&(0,s.clearBuffer)(),l}},{key:"intersectsBox",value:function(e,t,r){return b.set(t.min,t.max,r),b.update(),this.shapecast(e,function(e){return b.intersectsBox(e)},function(e){return b.intersectsTriangle(e)})}},{key:"intersectsSphere",value:function(e,t){return this.shapecast(e,function(e){return t.intersectsBox(e)},function(e){return e.intersectsSphere(t)})}},{key:"closestPointToGeometry",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),b.set(t.boundingBox.min,t.boundingBox.max,r),b.update();var u=t.attributes.position,l=t.index,f=null,c=null;n&&(f=B),i&&(c=w);var d=1/0;return this.shapecast(e,function(e,t,r){return rd)){m.update();var y=e.distanceToTriangle(m,f,c);if(y3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=1/0;return this.shapecast(e,function(e,t,r){return r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e._oldDepth=-1,e.mesh=t,e._boundsTree=null,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this;this._oldDepth=this.depth,this._boundsTree=this.mesh.geometry.boundsTree;var o=0;for(this._boundsTree&&this._boundsTree.traverse(function(n,i,u,s,c){var a=i||c;if(n>=r.depth)return!0;if(n===r.depth-1||a){var l=oo;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new m(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; +},{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;il?w.NOT_INTERSECTED:(e.expandByScalar(o),c.intersectsBox(e)?w.INTERSECTED:w.NOT_INTERSECTED)},function(e){if(c.distanceSqToPoint(e.a)l?w.NOT_INTERSECTED:(e.expandByScalar(o),c.intersectsBox(e)?w.INTERSECTED:w.NOT_INTERSECTED)},intersectsTriangle:function(e){if(c.distanceSqToPoint(e.a)THREE.js BVH Geometry point clouds
Point cloud intersection by modeling points as degenerate triangles with MeshBVH.

Model by SiteScape on Sketchfab.
- \ No newline at end of file +THREE.js BVH Geometry point clouds
Point cloud intersection by modeling points as degenerate triangles with MeshBVH.

Model by SiteScape on Sketchfab.
\ No newline at end of file diff --git a/example/bundle/randomSampleDebug.32ad2b43.js b/example/bundle/randomSampleDebug.32ad2b43.js index 9e707691d..1d0b95969 100644 --- a/example/bundle/randomSampleDebug.32ad2b43.js +++ b/example/bundle/randomSampleDebug.32ad2b43.js @@ -7,15 +7,15 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;iMath.PI&&(t-=s),n<-Math.PI?n+=s:n>Math.PI&&(n-=s),E.theta=t<=n?Math.max(t,Math.min(n,E.theta)):E.theta>(t+n)/2?Math.max(t,E.theta):Math.min(n,E.theta)),E.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,E.phi)),E.makeSafe(),E.radius*=O,E.radius=Math.max(u.minDistance,Math.min(u.maxDistance,E.radius)),!0===u.enableDamping?u.target.addScaledVector(g,u.dampingFactor):u.target.add(g),o.setFromSpherical(E),o.applyQuaternion(i),e.copy(u.target).add(o),u.object.lookAt(u.target),!0===u.enableDamping?(f.theta*=1-u.dampingFactor,f.phi*=1-u.dampingFactor,g.multiplyScalar(1-u.dampingFactor)):(f.set(0,0,0),g.set(0,0,0)),O=1,!!(v||r.distanceToSquared(u.object.position)>b||8*(1-c.dot(u.object.quaternion))>b)&&(u.dispatchEvent(l),r.copy(u.object.position),c.copy(u.object.quaternion),v=!1,!0)}),this.dispose=function(){u.domElement.removeEventListener("contextmenu",te),u.domElement.removeEventListener("pointerdown",B),u.domElement.removeEventListener("wheel",q),u.domElement.removeEventListener("touchstart",J),u.domElement.removeEventListener("touchend",ee),u.domElement.removeEventListener("touchmove",$),u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),null!==u._domElementKeyEvents&&u._domElementKeyEvents.removeEventListener("keydown",Q)};var u=this,l={type:"change"},m={type:"start"},p={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,b=1e-6,E=new e.Spherical,f=new e.Spherical,O=1,g=new e.Vector3,v=!1,T=new e.Vector2,y=new e.Vector2,P=new e.Vector2,L=new e.Vector2,w=new e.Vector2,A=new e.Vector2,N=new e.Vector2,M=new e.Vector2,j=new e.Vector2;function D(){return Math.pow(.95,u.zoomSpeed)}function R(e){f.theta-=e}function S(e){f.phi-=e}var k,C=(k=new e.Vector3,function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),g.add(k)}),Y=function(){var t=new e.Vector3;return function(e,n){!0===u.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(u.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),x=function(){var t=new e.Vector3;return function(e,n){var o=u.domElement;if(u.object.isPerspectiveCamera){var a=u.object.position;t.copy(a).sub(u.target);var i=t.length();i*=Math.tan(u.object.fov/2*Math.PI/180),C(2*e*i/o.clientHeight,u.object.matrix),Y(2*n*i/o.clientHeight,u.object.matrix)}else u.object.isOrthographicCamera?(C(e*(u.object.right-u.object.left)/u.object.zoom/o.clientWidth,u.object.matrix),Y(n*(u.object.top-u.object.bottom)/u.object.zoom/o.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),u.enablePan=!1)}}();function H(e){u.object.isPerspectiveCamera?O/=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom*e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function U(e){u.object.isPerspectiveCamera?O*=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom/e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function _(e){T.set(e.clientX,e.clientY)}function V(e){L.set(e.clientX,e.clientY)}function z(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,n)}}function I(e){if(1==e.touches.length)L.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);L.set(t,n)}}function X(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);N.set(0,o)}function F(e){if(1==e.touches.length)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var o=u.domElement;R(2*Math.PI*P.x/o.clientHeight),S(2*Math.PI*P.y/o.clientHeight),T.copy(y)}function Z(e){if(1==e.touches.length)w.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);w.set(t,n)}A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w)}function K(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);M.set(0,o),j.set(0,Math.pow(M.y/N.y,u.zoomSpeed)),H(j.y),N.copy(M)}function B(t){if(!1!==u.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var n;switch(t.preventDefault(),u.domElement.focus?u.domElement.focus():window.focus(),t.button){case 0:n=u.mouseButtons.LEFT;break;case 1:n=u.mouseButtons.MIDDLE;break;case 2:n=u.mouseButtons.RIGHT;break;default:n=-1}switch(n){case e.MOUSE.DOLLY:if(!1===u.enableZoom)return;!function(e){N.set(e.clientX,e.clientY)}(t),d=h.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enablePan)return;V(t),d=h.PAN}else{if(!1===u.enableRotate)return;_(t),d=h.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enableRotate)return;_(t),d=h.ROTATE}else{if(!1===u.enablePan)return;V(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(u.domElement.ownerDocument.addEventListener("pointermove",G),u.domElement.ownerDocument.addEventListener("pointerup",W),u.dispatchEvent(m))}(t)}}function G(e){if(!1!==u.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===u.enabled)return;switch(e.preventDefault(),d){case h.ROTATE:if(!1===u.enableRotate)return;!function(e){y.set(e.clientX,e.clientY),P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var t=u.domElement;R(2*Math.PI*P.x/t.clientHeight),S(2*Math.PI*P.y/t.clientHeight),T.copy(y),u.update()}(e);break;case h.DOLLY:if(!1===u.enableZoom)return;!function(e){M.set(e.clientX,e.clientY),j.subVectors(M,N),j.y>0?H(D()):j.y<0&&U(D()),N.copy(M),u.update()}(e);break;case h.PAN:if(!1===u.enablePan)return;!function(e){w.set(e.clientX,e.clientY),A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w),u.update()}(e)}}(e)}}function W(e){switch(e.pointerType){case"mouse":case"pen":!function(e){if(u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),!1===u.enabled)return;u.dispatchEvent(p),d=h.NONE}()}}function q(e){!1===u.enabled||!1===u.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),u.dispatchEvent(m),function(e){e.deltaY<0?U(D()):e.deltaY>0&&H(D()),u.update()}(e),u.dispatchEvent(p))}function Q(e){!1!==u.enabled&&!1!==u.enablePan&&function(e){var t=!1;switch(e.keyCode){case u.keys.UP:x(0,u.keyPanSpeed),t=!0;break;case u.keys.BOTTOM:x(0,-u.keyPanSpeed),t=!0;break;case u.keys.LEFT:x(u.keyPanSpeed,0),t=!0;break;case u.keys.RIGHT:x(-u.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),u.update())}(e)}function J(t){if(!1!==u.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(u.touches.ONE){case e.TOUCH.ROTATE:if(!1===u.enableRotate)return;z(t),d=h.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===u.enablePan)return;I(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(u.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&X(e),u.enablePan&&I(e)}(t),d=h.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&X(e),u.enableRotate&&z(e)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&u.dispatchEvent(m)}}function $(e){if(!1!==u.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===u.enableRotate)return;F(e),u.update();break;case h.TOUCH_PAN:if(!1===u.enablePan)return;Z(e),u.update();break;case h.TOUCH_DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&K(e),u.enablePan&&Z(e)}(e),u.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&K(e),u.enableRotate&&F(e)}(e),u.update();break;default:d=h.NONE}}function ee(e){!1!==u.enabled&&(u.dispatchEvent(p),d=h.NONE)}function te(e){!1!==u.enabled&&e.preventDefault()}u.domElement.addEventListener("contextmenu",te),u.domElement.addEventListener("pointerdown",B),u.domElement.addEventListener("wheel",q),u.domElement.addEventListener("touchstart",J),u.domElement.addEventListener("touchend",ee),u.domElement.addEventListener("touchmove",$),this.update()};exports.OrbitControls=t,t.prototype=Object.create(e.EventDispatcher.prototype),t.prototype.constructor=t;var n=function(n,o){t.call(this,n,o),this.screenSpacePanning=!1,this.mouseButtons.LEFT=e.MOUSE.PAN,this.mouseButtons.RIGHT=e.MOUSE.ROTATE,this.touches.ONE=e.TOUCH.PAN,this.touches.TWO=e.TOUCH.DOLLY_ROTATE};exports.MapControls=n,n.prototype=Object.create(e.EventDispatcher.prototype),n.prototype.constructor=n; },{"../../../build/three.module.js":"dKqR"}],"OLLT":[function(require,module,exports) { -"use strict";var e,t,r,n=c(require("three")),o=require("../src/index.js"),i=s(require("../src/MeshBVHVisualizer.js")),a=require("three/examples/jsm/controls/OrbitControls.js");function s(e){return e&&e.__esModule?e:{default:e}}function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function c(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,t&&t.set(e,r),r}n.Mesh.prototype.raycast=o.acceleratedRaycast,n.BufferGeometry.prototype.computeBoundsTree=o.computeBoundsTree,n.BufferGeometry.prototype.disposeBoundsTree=o.disposeBoundsTree;var u=[],l=null;function p(){if(null===l)throw new Error;return(l=(1103515245*l+12345)%2e31)/2e31}function w(){(e=new n.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1118481,1),e.gammaOutput=!0,document.body.appendChild(e.domElement),r=new n.Scene;var s=new n.DirectionalLight(16777215,1);s.position.set(1,1,1),r.add(s),r.add(new n.AmbientLight(11583173,.8)),(t=new n.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,4),t.far=100,t.updateProjectionMatrix(),new a.OrbitControls(t,e.domElement);var d={strategy:o.AVERAGE,packData:!1,lazyGeneration:!1,maxDepth:1},c=new n.TorusBufferGeometry(1,1,40,10);c.computeBoundsTree(d),l=7830035629,p();for(var w=0;w<10;w++){var f=new n.Mesh(c,new n.MeshStandardMaterial);if(f.rotation.x=10*p(),f.rotation.y=10*p(),f.rotation.z=10*p(),f.position.x=p(),f.position.y=p(),f.position.z=p(),2===w){u.push(f),r.add(f);var y=f.clone();y.material=new n.MeshBasicMaterial({wireframe:!0,color:16737894}),r.add(y);var m=new i.default(f,10);r.add(m)}f.updateMatrix(!0),f.updateMatrixWorld(!0)}l=4697211981,p();var h=new n.Raycaster;h.firstHitOnly=!1,h.ray.origin.set(10*p(),10*p(),10*p()),h.ray.direction.copy(h.ray.origin).multiplyScalar(-1).normalize();var v=new n.SphereBufferGeometry(.1),g=new n.Mesh(v);g.position.copy(h.ray.at(0)),r.add(g);var O=h.intersectObjects(u,!0);h.firstHitOnly=!0;var M=h.intersectObjects(u,!0);c.boundsTree=null;var b=h.intersectObjects(u,!0);console.log("FIRST HIT",M),console.log("BVH HITS",O),console.log("OG HITS",b);var j=g.clone();j.position.copy(M[0].point),r.add(j);var B=g.clone();B.position.copy(O[0].point),r.add(B);var x=new n.Line;x.geometry.setFromPoints([h.ray.at(0,new n.Vector3),h.ray.at(20,new n.Vector3)]),r.add(x),window.addEventListener("resize",function(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}function f(){requestAnimationFrame(f),e.render(r,t)}w(),f(); +"use strict";var e,t,r,n=c(require("three")),o=require("../src/index.js"),i=s(require("../src/MeshBVHVisualizer.js")),a=require("three/examples/jsm/controls/OrbitControls.js");function s(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}n.Mesh.prototype.raycast=o.acceleratedRaycast,n.BufferGeometry.prototype.computeBoundsTree=o.computeBoundsTree,n.BufferGeometry.prototype.disposeBoundsTree=o.disposeBoundsTree;var u=[],l=null;function p(){if(null===l)throw new Error;return(l=(1103515245*l+12345)%2e31)/2e31}function w(){(e=new n.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1118481,1),e.gammaOutput=!0,document.body.appendChild(e.domElement),r=new n.Scene;var s=new n.DirectionalLight(16777215,1);s.position.set(1,1,1),r.add(s),r.add(new n.AmbientLight(11583173,.8)),(t=new n.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,4),t.far=100,t.updateProjectionMatrix(),new a.OrbitControls(t,e.domElement);var d={strategy:o.AVERAGE,packData:!1,lazyGeneration:!1,maxDepth:1},c=new n.TorusBufferGeometry(1,1,40,10);c.computeBoundsTree(d),l=7830035629,p();for(var w=0;w<10;w++){var f=new n.Mesh(c,new n.MeshStandardMaterial);if(f.rotation.x=10*p(),f.rotation.y=10*p(),f.rotation.z=10*p(),f.position.x=p(),f.position.y=p(),f.position.z=p(),2===w){u.push(f),r.add(f);var y=f.clone();y.material=new n.MeshBasicMaterial({wireframe:!0,color:16737894}),r.add(y);var m=new i.default(f,10);r.add(m)}f.updateMatrix(!0),f.updateMatrixWorld(!0)}l=4697211981,p();var h=new n.Raycaster;h.firstHitOnly=!1,h.ray.origin.set(10*p(),10*p(),10*p()),h.ray.direction.copy(h.ray.origin).multiplyScalar(-1).normalize();var v=new n.SphereBufferGeometry(.1),g=new n.Mesh(v);g.position.copy(h.ray.at(0)),r.add(g);var M=h.intersectObjects(u,!0);h.firstHitOnly=!0;var O=h.intersectObjects(u,!0);c.boundsTree=null;var b=h.intersectObjects(u,!0);console.log("FIRST HIT",O),console.log("BVH HITS",M),console.log("OG HITS",b);var j=g.clone();j.position.copy(O[0].point),r.add(j);var B=g.clone();B.position.copy(M[0].point),r.add(B);var x=new n.Line;x.geometry.setFromPoints([h.ray.at(0,new n.Vector3),h.ray.at(20,new n.Vector3)]),r.add(x),window.addEventListener("resize",function(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}function f(){requestAnimationFrame(f),e.render(r,t)}w(),f(); },{"three":"dKqR","../src/index.js":"uBxZ","../src/MeshBVHVisualizer.js":"jNwr","three/examples/jsm/controls/OrbitControls.js":"xTGv"}]},{},["OLLT"], null) \ No newline at end of file diff --git a/example/bundle/raycast.88074831.js b/example/bundle/raycast.88074831.js index 0b829ad30..cd70e4c0f 100644 --- a/example/bundle/raycast.88074831.js +++ b/example/bundle/raycast.88074831.js @@ -2,7 +2,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var e=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e); },{}],"ss9A":[function(require,module,exports) { -var e=module.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e); +var e=module.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e); },{}],"M7z6":[function(require,module,exports) { module.exports=function(o){return"object"==typeof o?null!==o:"function"==typeof o}; },{}],"eT53":[function(require,module,exports) { @@ -31,7 +31,7 @@ var o=0,t=Math.random();module.exports=function(n){return"Symbol(".concat(void 0 module.exports=!1; },{}],"zGcK":[function(require,module,exports) { -var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"}); +var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"}); },{"./_core":"ss9A","./_global":"qf4T","./_library":"H21C"}],"d5RU":[function(require,module,exports) { module.exports=require("./_shared")("native-function-to-string",Function.toString); },{"./_shared":"zGcK"}],"PHot":[function(require,module,exports) { @@ -78,7 +78,11 @@ var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("spec var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)}; },{"./_array-species-constructor":"NNbH"}],"AuPh":[function(require,module,exports) { var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; -},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { +},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Hh2M":[function(require,module,exports) { +"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; +},{"./_fails":"BXiR"}],"GyG6":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(2);r(r.P+r.F*!require("./_strict-method")([].filter,!0),"Array",{filter:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"Qppk":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); },{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); @@ -134,20 +138,20 @@ var t=require("./_has"),e=require("./_to-object"),o=require("./_shared-key")("IE "use strict";var e=require("./_library"),r=require("./_export"),t=require("./_redefine"),i=require("./_hide"),n=require("./_iterators"),u=require("./_iter-create"),o=require("./_set-to-string-tag"),s=require("./_object-gpo"),a=require("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",l="keys",q="values",y=function(){return this};module.exports=function(_,p,h,k,v,w,d){u(h,p,k);var x,b,g,j=function(e){if(!c&&e in I)return I[e];switch(e){case l:case q:return function(){return new h(this,e)}}return function(){return new h(this,e)}},m=p+" Iterator",A=v==q,F=!1,I=_.prototype,O=I[a]||I[f]||v&&I[v],P=O||j(v),z=v?A?j("entries"):P:void 0,B="Array"==p&&I.entries||O;if(B&&(g=s(B.call(new _)))!==Object.prototype&&g.next&&(o(g,m,!0),e||"function"==typeof g[a]||i(g,a,y)),A&&O&&O.name!==q&&(F=!0,P=function(){return O.call(this)}),e&&!d||!c&&!F&&I[a]||i(I,a,P),n[p]=P,n[m]=y,v)if(x={values:A?P:j(q),keys:w?P:j(l),entries:z},d)for(b in x)b in I||t(I,b,x[b]);else r(r.P+r.F*(c||F),p,x);return x}; },{"./_library":"H21C","./_export":"izCb","./_redefine":"PHot","./_hide":"NXbe","./_iterators":"JO4d","./_iter-create":"ebgP","./_set-to-string-tag":"rq3q","./_object-gpo":"q6yw","./_wks":"AIP1"}],"wVEN":[function(require,module,exports) { "use strict";var e=require("./_add-to-unscopables"),r=require("./_iter-step"),t=require("./_iterators"),i=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=i(e),this._i=0,this._k=r},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])},"values"),t.Arguments=t.Array,e("keys"),e("values"),e("entries"); -},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RB6b":[function(require,module,exports) { +},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RBsu":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(1);r(r.P+r.F*!require("./_strict-method")([].map,!0),"Array",{map:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"RB6b":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_create-property");r(r.S+r.F*require("./_fails")(function(){function r(){}return!(Array.of.call(r)instanceof r)}),"Array",{of:function(){for(var r=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>r;)e(n,r,arguments[r++]);return n.length=t,n}}); -},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"Hh2M":[function(require,module,exports) { -"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; -},{"./_fails":"BXiR"}],"nrVf":[function(require,module,exports) { +},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"btFn":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_html"),i=require("./_cof"),t=require("./_to-absolute-index"),u=require("./_to-length"),a=[].slice;r(r.P+r.F*require("./_fails")(function(){e&&a.call(e)}),"Array",{slice:function(r,e){var l=u(this.length),n=i(this);if(e=void 0===e?l:e,"Array"==n)return a.call(this,r,e);for(var s=t(r,l),c=t(e,l),h=u(c-s),o=new Array(h),f=0;f=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)} -},{}],"dnrf":[function(require,module,exports) { +},{"./es6.array.iterator":"wVEN","./_object-keys":"U9a7","./_redefine":"PHot","./_global":"qf4T","./_hide":"NXbe","./_iterators":"JO4d","./_wks":"AIP1"}],"dnrf":[function(require,module,exports) { var define; var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof e&&e.amd?e(n):t.Stats=n()}(this,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;to+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var l=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,s=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,s,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p,u,s,m),{dom:h,update:function(f,y){l=Math.min(l,f),i=Math.max(i,f),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(a(f)+" "+e+" ("+a(l)+"-"+a(i)+")",c,d),v.drawImage(h,p+o,u,s-o,m,p,u,s-o,m),v.fillRect(p+s-o,u,o,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p+s-o,u,o,a((1-f/y)*m))}}},e}); },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"dKqR":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArrayCamera=ch,exports.AxisHelper=lx,exports.BinaryTextureLoader=dx,exports.Bone=Yh,exports.BoundingBoxHelper=cx,exports.BufferAttribute=bi,exports.BufferGeometry=ki,exports.Camera=gs,exports.CanvasRenderer=fx,exports.CompressedTextureLoader=md,exports.CubicInterpolant=Xp,exports.Curve=yd,exports.DataTextureLoader=xd,exports.DiscreteInterpolant=Zp,exports.DynamicBufferAttribute=Kg,exports.EdgesHelper=hx,exports.EventDispatcher=In,exports.FileLoader=pd,exports.Float16BufferAttribute=Ri,exports.Float32Attribute=ox,exports.Float32BufferAttribute=Ci,exports.Float64Attribute=ax,exports.Float64BufferAttribute=Pi,exports.GLBufferAttribute=xf,exports.ImageBitmapLoader=Sm,exports.ImmediateRenderObject=Lf,exports.InstancedBufferAttribute=vm,exports.InstancedBufferGeometry=xm,exports.InstancedInterleavedBuffer=gf,exports.InstancedMesh=nu,exports.Int16Attribute=nx,exports.Int16BufferAttribute=Ti,exports.Int32Attribute=ix,exports.Int32BufferAttribute=Ai,exports.Int8Attribute=$g,exports.Int8BufferAttribute=wi,exports.InterleavedBuffer=_h,exports.InterleavedBufferAttribute=wh,exports.Interpolant=qp,exports.JSONLoader=gx,exports.LensFlare=vx,exports.Line=cu,exports.LineSegments=pu,exports.LinearInterpolant=Yp,exports.Loader=hd,exports.LoadingManager=ld,exports.Material=hi,exports.Mesh=os,exports.MeshFaceMaterial=Vg,exports.MeshPhysicalMaterial=Op,exports.MeshStandardMaterial=Fp,exports.MultiMaterial=Wg,exports.Object3D=Xr,exports.ParametricGeometry=exports.ParametricBufferGeometry=wp,exports.Particle=qg,exports.ParticleBasicMaterial=Zg,exports.ParticleSystem=Xg,exports.ParticleSystemMaterial=Jg,exports.PerspectiveCamera=xs,exports.PointCloud=jg,exports.PointCloudMaterial=Yg,exports.Points=yu,exports.PropertyBinding=uf,exports.QuaternionLinearInterpolant=td,exports.Raycaster=vf,exports.ShaderMaterial=fs,exports.SkinnedMesh=Xh,exports.TextureLoader=vd,exports.Uint16Attribute=rx,exports.Uint16BufferAttribute=Ei,exports.Uint32Attribute=sx,exports.Uint32BufferAttribute=Li,exports.Uint8Attribute=tx,exports.Uint8BufferAttribute=Mi,exports.Uint8ClampedAttribute=ex,exports.Uint8ClampedBufferAttribute=Si,exports.Vertex=Qg,exports.WebGLRenderTargetCube=mx,exports.WebGLRenderer=fh,exports.WebGLUtils=lh,exports.WireframeHelper=ux,exports.XHRLoader=px,exports.FloatType=exports.FlatShading=exports.FaceColors=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTexture=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CanvasTexture=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.ObjectLoader=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MaterialLoader=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.ImageLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.FontLoader=exports.Font=exports.FogExp2=exports.Fog=void 0,exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.Path=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VertexColors=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.Texture=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=void 0;const t="126";exports.REVISION="126";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const r=0;exports.CullFaceNone=r;const i=1;exports.CullFaceBack=i;const s=2;exports.CullFaceFront=s;const o=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const l=1;exports.PCFShadowMap=l;const c=2;exports.PCFSoftShadowMap=c;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const m=1;exports.FlatShading=1;const f=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const I=206;exports.DstAlphaFactor=I;const B=207;exports.OneMinusDstAlphaFactor=B;const N=208;exports.DstColorFactor=N;const F=209;exports.OneMinusDstColorFactor=F;const O=210;exports.SrcAlphaSaturateFactor=O;const z=0;exports.NeverDepth=z;const G=1;exports.AlwaysDepth=G;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=et;const nt=301;exports.CubeReflectionMapping=nt;const rt=302;exports.CubeRefractionMapping=rt;const it=303;exports.EquirectangularReflectionMapping=it;const st=304;exports.EquirectangularRefractionMapping=st;const ot=306;exports.CubeUVReflectionMapping=ot;const at=307;exports.CubeUVRefractionMapping=at;const lt=1e3;exports.RepeatWrapping=lt;const ct=1001;exports.ClampToEdgeWrapping=ct;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const mt=1005;exports.NearestMipmapLinearFilter=mt;const ft=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const It=1021;exports.AlphaFormat=It;const Bt=1022;exports.RGBFormat=Bt;const Nt=1023;exports.RGBAFormat=Nt;const Ft=1024;exports.LuminanceFormat=Ft;const Ot=1025;exports.LuminanceAlphaFormat=Ot;const zt=Nt;exports.RGBEFormat=zt;const Gt=1026;exports.DepthFormat=Gt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const re=37496;exports.RGBA_ETC2_EAC_Format=re;const ie=37808;exports.RGBA_ASTC_4x4_Format=ie;const se=37809;exports.RGBA_ASTC_5x4_Format=se;const oe=37810;exports.RGBA_ASTC_5x5_Format=oe;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const le=37812;exports.RGBA_ASTC_6x6_Format=le;const ce=37813;exports.RGBA_ASTC_8x5_Format=ce;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const me=37818;exports.RGBA_ASTC_10x8_Format=me;const fe=37819;exports.RGBA_ASTC_10x10_Format=fe;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Ie=2200;exports.LoopOnce=Ie;const Be=2201;exports.LoopRepeat=Be;const Ne=2202;exports.LoopPingPong=Ne;const Fe=2300;exports.InterpolateDiscrete=Fe;const Oe=2301;exports.InterpolateLinear=Oe;const ze=2302;exports.InterpolateSmooth=ze;const Ge=2400;exports.ZeroCurvatureEnding=Ge;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const sn=1;exports.ObjectSpaceNormalMap=sn;const on=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const ln=7681;exports.ReplaceStencilOp=7681;const cn=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const mn=512;exports.NeverStencilFunc=512;const fn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function In(){}exports.GLSL3=Dn,Object.assign(In.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e>8&255]+Bn[t>>16&255]+Bn[t>>24&255]+"-"+Bn[255&e]+Bn[e>>8&255]+"-"+Bn[e>>16&15|64]+Bn[e>>24&255]+"-"+Bn[63&n|128]+Bn[n>>8&255]+"-"+Bn[n>>16&255]+Bn[n>>24&255]+Bn[255&r]+Bn[r>>8&255]+Bn[r>>16&255]+Bn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Fn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Fn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Nn=t%2147483647),((Nn=16807*Nn%2147483647)-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),h=o((e+r)/2),u=s((e-r)/2),p=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(i){case"XYX":t.set(a*h,l*u,l*p,a*c);break;case"YZY":t.set(l*p,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*p,a*h,a*c);break;case"XZX":t.set(a*h,l*m,l*d,a*c);break;case"YXY":t.set(l*d,a*h,l*m,a*c);break;case"ZYZ":t.set(l*m,l*d,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};exports.MathUtils=exports.Math=Fn;class On{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=On,On.prototype.isVector2=!0;class zn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],m=r[0],f=r[3],g=r[6],x=r[1],v=r[4],y=r[7],_=r[2],b=r[5],w=r[8];return i[0]=s*m+o*x+a*_,i[3]=s*f+o*v+a*b,i[6]=s*g+o*y+a*w,i[1]=l*m+c*x+h*_,i[4]=l*f+c*v+h*b,i[7]=l*g+c*y+h*w,i[2]=u*m+p*x+d*_,i[5]=u*f+p*v+d*b,i[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*i*c+n*o*a+r*i*l-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*i,p=l*i-s*a,d=e*h+n*u+r*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=h*m,t[1]=(r*l-c*n)*m,t[2]=(o*n-r*s)*m,t[3]=u*m,t[4]=(c*e-r*a)*m,t[5]=(r*i-o*e)*m,t[6]=p*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*i)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,s,o){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-r*l,r*a,-r*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],l=r[4],c=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*a,r[4]=-n*s+e*l,r[7]=-n*o+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;exports.Matrix3=zn,zn.prototype.isMatrix3=!0;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;class kn extends In{constructor(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=ct,r=ct,i=gt,s=yt,o=Nt,a=bt,l=1,c=Xe){super(),Object.defineProperty(this,"id",{value:Un++}),this.uuid=Fn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new On(0,0),this.repeat=new On(1,1),this.center=new On(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=Fn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t1)switch(this.wrapS){case lt:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case lt:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}exports.Texture=kn,kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=et,kn.prototype.isTexture=!0;class Wn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const s=t.elements,o=s[0],a=s[4],l=s[8],c=s[1],h=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(h+1)/2,f=(m+1)/2,g=(a+c)/4,x=(l+p)/4,v=(u+d)/4;return t>s&&t>f?t<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(t)),i=x/n):s>f?s<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(s)),i=v/r):f<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(f)),r=v/i),this.set(n,r,i,e),this}let f=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-a)*(c-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(l-p)/f,this.z=(c-a)/f,this.w=Math.acos((o+h+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn,Wn.prototype.isVector4=!0;class jn extends In{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn,jn.prototype.isWebGLRenderTarget=!0;class qn extends jn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn,qn.prototype.isWebGLMultisampleRenderTarget=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[s+0],p=i[s+1],d=i[s+2],m=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(h!==m||a!==u||l!==p||c!==d){let t=1-o;const e=a*u+l*p+c*d+h*m,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+u*i,l=l*t+p*i,c=c*t+d*i,h=h*t+m*i,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[s],u=i[s+1],p=i[s+2],d=i[s+3];return t[e]=o*d+c*h+a*p-l*u,t[e+1]=a*d+c*u+l*h-o*p,t[e+2]=l*d+c*p+o*u-a*h,t[e+3]=c*d-o*h-a*u-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=a(n/2),p=a(r/2),d=a(i/2);switch(s){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(i-l)*t,this._z=(s-r)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(i-l)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-r)/t,this._x=(i+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+r*l-i*a,this._y=r*c+s*a+i*o-n*l,this._z=i*c+s*l+n*a-r*o,this._w=s*c-n*o-r*a-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn,Xn.prototype.isQuaternion=!0;class Yn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*r-o*n,c=a*n+o*e-i*r,h=a*r+i*n-s*e,u=-i*e-s*n-o*r;return this.x=l*a+u*-i+c*-o-h*-s,this.y=c*a+u*-s+h*-i-l*-o,this.z=h*a+u*-o+l*-s-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn,Yn.prototype.isVector3=!0;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t=new Yn(1/0,1/0,1/0),e=new Yn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$n),$n.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ar),lr.subVectors(this.max,ar),er.subVectors(t.a,ar),nr.subVectors(t.b,ar),rr.subVectors(t.c,ar),ir.subVectors(nr,er),sr.subVectors(rr,nr),or.subVectors(er,rr);let e=[0,-ir.z,ir.y,0,-sr.z,sr.y,0,-or.z,or.y,ir.z,0,-ir.x,sr.z,0,-sr.x,or.z,0,-or.x,-ir.y,ir.x,0,-sr.y,sr.x,0,-or.y,or.x,0];return!!ur(e,er,nr,rr,lr)&&(!!ur(e=[1,0,0,0,1,0,0,0,1],er,nr,rr,lr)&&(cr.crossVectors(ir,sr),ur(e=[cr.x,cr.y,cr.z],er,nr,rr,lr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $n.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize($n).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box3=Qn,Qn.prototype.isBox3=!0;const Kn=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],$n=new Yn,tr=new Qn,er=new Yn,nr=new Yn,rr=new Yn,ir=new Yn,sr=new Yn,or=new Yn,ar=new Yn,lr=new Yn,cr=new Yn,hr=new Yn;function ur(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){hr.fromArray(t,s);const o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),a=e.dot(hr),l=n.dot(hr),c=r.dot(hr);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const pr=new Qn;class dr{constructor(t=new Yn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}exports.Sphere=dr;const mr=new Yn,fr=new Yn,gr=new Yn,xr=new Yn,vr=new Yn,yr=new Yn,_r=new Yn;class br{constructor(t=new Yn,e=new Yn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mr.copy(this.direction).multiplyScalar(e).add(this.origin),mr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){fr.copy(t).add(e).multiplyScalar(.5),gr.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(fr);const i=.5*t.distanceTo(e),s=-this.direction.dot(gr),o=xr.dot(this.direction),a=-xr.dot(gr),l=xr.lengthSq(),c=Math.abs(1-s*s);let h,u,p,d;if(c>0)if(u=s*o-a,d=i*c,(h=s*a-o)>=0)if(u>=-d)if(u<=d){const t=1/c;p=(h*=t)*(h+s*(u*=t)+2*o)+u*(s*h+u+2*a)+l}else u=i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u=-i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u<=-d?p=-(h=Math.max(0,-(-s*i+o)))*h+(u=h>0?-i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l:u<=d?(h=0,p=(u=Math.min(Math.max(-i,-a),i))*(u+2*a)+l):p=-(h=Math.max(0,-(s*i+o)))*h+(u=h>0?i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l;else u=s>0?-i:i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(gr).multiplyScalar(u).add(fr),p}intersectSphere(t,e){mr.subVectors(t.center,this.origin);const n=mr.dot(this.direction),r=mr.dot(mr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,r=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,r=(t.min.x-u.x)*l),c>=0?(i=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(i=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||i>r?null:((i>n||n!=n)&&(n=i),(s=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>r?null:((o>n||n!=n)&&(n=o),(a=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mr)}intersectTriangle(t,e,n,r,i){vr.subVectors(e,t),yr.subVectors(n,t),_r.crossVectors(vr,yr);let s,o=this.direction.dot(_r);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}xr.subVectors(this.origin,t);const a=s*this.direction.dot(yr.crossVectors(xr,yr));if(a<0)return null;const l=s*this.direction.dot(vr.cross(xr));if(l<0)return null;if(a+l>o)return null;const c=-s*xr.dot(_r);return c<0?null:this.at(c/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}exports.Ray=br;class wr{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l,c,h,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wr).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Mr.setFromMatrixColumn(t,0).length(),i=1/Mr.setFromMatrixColumn(t,1).length(),s=1/Mr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-o*a,e[2]=i-t*l,e[6]=r+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t-i*o,e[4]=-s*h,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*c,e[9]=i-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=a*h,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=i-t*h,e[8]=r*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+r,e[10]=t-i*h}else if("XZY"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+i,e[5]=s*c,e[9]=n*h-r,e[2]=r*h-n,e[6]=o*c,e[10]=i*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tr,t,Er)}lookAt(t,e,n){const r=this.elements;return Rr.subVectors(t,e),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ar.crossVectors(n,Rr),0===Ar.lengthSq()&&(1===Math.abs(n.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ar.crossVectors(n,Rr)),Ar.normalize(),Lr.crossVectors(Rr,Ar),r[0]=Ar.x,r[4]=Lr.x,r[8]=Rr.x,r[1]=Ar.y,r[5]=Lr.y,r[9]=Rr.y,r[2]=Ar.z,r[6]=Lr.z,r[10]=Rr.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],m=n[6],f=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],B=r[7],N=r[11],F=r[15];return i[0]=s*b+o*T+a*R+l*I,i[4]=s*w+o*E+a*C+l*B,i[8]=s*M+o*A+a*P+l*N,i[12]=s*S+o*L+a*D+l*F,i[1]=c*b+h*T+u*R+p*I,i[5]=c*w+h*E+u*C+p*B,i[9]=c*M+h*A+u*P+p*N,i[13]=c*S+h*L+u*D+p*F,i[2]=d*b+m*T+f*R+g*I,i[6]=d*w+m*E+f*C+g*B,i[10]=d*M+m*A+f*P+g*N,i[14]=d*S+m*L+f*D+g*F,i[3]=x*b+v*T+y*R+_*I,i[7]=x*w+v*E+y*C+_*B,i[11]=x*M+v*A+y*P+_*N,i[15]=x*S+v*L+y*D+_*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+i*a*h-r*l*h-i*o*u+n*l*u+r*o*p-n*a*p)+t[7]*(+e*a*p-e*l*u+i*s*u-r*s*p+r*l*c-i*a*c)+t[11]*(+e*l*h-e*o*p-i*s*h+n*s*p+i*o*c-n*l*c)+t[15]*(-r*o*c-e*a*h+e*o*u+r*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],x=h*f*l-m*u*l+m*a*p-o*f*p-h*a*g+o*u*g,v=d*u*l-c*f*l-d*a*p+s*f*p+c*a*g-s*u*g,y=c*m*l-d*h*l+d*o*p-s*m*p-c*o*g+s*h*g,_=d*h*a-c*m*a-d*o*u+s*m*u+c*o*f-s*h*f,b=e*x+n*v+r*y+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=x*w,t[1]=(m*u*i-h*f*i-m*r*p+n*f*p+h*r*g-n*u*g)*w,t[2]=(o*f*i-m*a*i+m*r*l-n*f*l-o*r*g+n*a*g)*w,t[3]=(h*a*i-o*u*i-h*r*l+n*u*l+o*r*p-n*a*p)*w,t[4]=v*w,t[5]=(c*f*i-d*u*i+d*r*p-e*f*p-c*r*g+e*u*g)*w,t[6]=(d*a*i-s*f*i-d*r*l+e*f*l+s*r*g-e*a*g)*w,t[7]=(s*u*i-c*a*i+c*r*l-e*u*l-s*r*p+e*a*p)*w,t[8]=y*w,t[9]=(d*h*i-c*m*i-d*n*p+e*m*p+c*n*g-e*h*g)*w,t[10]=(s*m*i-d*o*i+d*n*l-e*m*l-s*n*g+e*o*g)*w,t[11]=(c*o*i-s*h*i-c*n*l+e*h*l+s*n*p-e*o*p)*w,t[12]=_*w,t[13]=(c*m*r-d*h*r+d*n*u-e*m*u-c*n*f+e*h*f)*w,t[14]=(d*o*r-s*m*r-d*n*a+e*m*a+s*n*f-e*o*f)*w,t[15]=(s*h*r-c*o*r+c*n*a-e*h*a-s*n*u+e*o*u)*w,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,l=i*s,c=i*o;return this.set(l*s+n,l*o-r*a,l*a+r*o,0,l*o+r*a,c*o+n,c*a-r*s,0,l*a-r*o,c*a+r*s,i*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,l=i+i,c=s+s,h=o+o,u=i*l,p=i*c,d=i*h,m=s*c,f=s*h,g=o*h,x=a*l,v=a*c,y=a*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(m+g))*_,r[1]=(p+y)*_,r[2]=(d-v)*_,r[3]=0,r[4]=(p-y)*b,r[5]=(1-(u+g))*b,r[6]=(f+x)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(f-x)*w,r[10]=(1-(u+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Mr.set(r[0],r[1],r[2]).length();const s=Mr.set(r[4],r[5],r[6]).length(),o=Mr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Sr.copy(this);const a=1/i,l=1/s,c=1/o;return Sr.elements[0]*=a,Sr.elements[1]*=a,Sr.elements[2]*=a,Sr.elements[4]*=l,Sr.elements[5]*=l,Sr.elements[6]*=l,Sr.elements[8]*=c,Sr.elements[9]*=c,Sr.elements[10]*=c,e.setFromRotationMatrix(Sr),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),h=(n+r)/(n-r),u=-(s+i)/(s-i),p=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),l=1/(n-r),c=1/(s-i),h=(e+t)*a,u=(n+r)*l,p=(s+i)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wr,wr.prototype.isMatrix4=!0;const Mr=new Yn,Sr=new wr,Tr=new Yn(0,0,0),Er=new Yn(1,1,1),Ar=new Yn,Lr=new Yn,Rr=new Yn,Cr=new wr,Pr=new Xn;class Dr{constructor(t=0,e=0,n=0,r=Dr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Fn.clamp,i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Pr.setFromEuler(this),this.setFromQuaternion(Pr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Dr,Dr.prototype.isEuler=!0,Dr.DefaultOrder="XYZ",Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ir{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){r.children=[];for(let e=0;e0){r.animations=[];for(let e=0;e0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function s(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n1?void 0:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Jr.getNormalMatrix(t),r=this.coplanarPoint(Yr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}exports.Plane=Qr,Qr.prototype.isPlane=!0;const Kr=new Yn,$r=new Yn,ti=new Yn,ei=new Yn,ni=new Yn,ri=new Yn,ii=new Yn,si=new Yn,oi=new Yn,ai=new Yn;class li{constructor(t=new Yn,e=new Yn,n=new Yn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Yn),r.subVectors(n,e),Kr.subVectors(t,e),r.cross(Kr);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Kr.subVectors(r,e),$r.subVectors(n,e),ti.subVectors(t,e);const s=Kr.dot(Kr),o=Kr.dot($r),a=Kr.dot(ti),l=$r.dot($r),c=$r.dot(ti),h=s*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Yn),0===h)return i.set(-2,-1,-1);const u=1/h,p=(l*a-o*c)*u,d=(s*c-o*a)*u;return i.set(1-p-d,d,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ei),a.set(0,0),a.addScaledVector(i,ei.x),a.addScaledVector(s,ei.y),a.addScaledVector(o,ei.z),a}static isFrontFacing(t,e,n,r){return Kr.subVectors(n,e),$r.subVectors(t,e),Kr.cross($r).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Kr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Kr.cross($r).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return li.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qr),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return li.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return li.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return li.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return li.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,r=this.b,i=this.c;let s,o;ni.subVectors(r,n),ri.subVectors(i,n),si.subVectors(t,n);const a=ni.dot(si),l=ri.dot(si);if(a<=0&&l<=0)return e.copy(n);oi.subVectors(t,r);const c=ni.dot(oi),h=ri.dot(oi);if(c>=0&&h<=c)return e.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(ni,s);ai.subVectors(t,i);const p=ni.dot(ai),d=ri.dot(ai);if(d>=0&&p<=d)return e.copy(i);const m=p*l-a*d;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),e.copy(n).addScaledVector(ri,o);const f=c*d-p*h;if(f<=0&&h-c>=0&&p-d>=0)return ii.subVectors(i,r),o=(h-c)/(h-c+(p-d)),e.copy(r).addScaledVector(ii,o);const g=1/(f+m+u);return s=m*g,o=u*g,e.copy(n).addScaledVector(ni,s).addScaledVector(ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=li;let ci=0;function hi(){Object.defineProperty(this,"id",{value:ci++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}hi.prototype=Object.assign(Object.create(In.prototype),{constructor:hi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(hi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},di={h:0,s:0,l:0};function mi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function fi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=mi(i,r,t+1/3),this.g=mi(i,r,t),this.b=mi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ui[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}copyLinearToSRGB(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const l=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=l<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(ne&&(e=t[n]);return e}Object.defineProperty(bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r65535?Li:Ei)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new zn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fi.makeRotationX(t),this.applyMatrix4(Fi),this},rotateY:function(t){return Fi.makeRotationY(t),this.applyMatrix4(Fi),this},rotateZ:function(t){return Fi.makeRotationZ(t),this.applyMatrix4(Fi),this},translate:function(t,e,n){return Fi.makeTranslation(t,e,n),this.applyMatrix4(Fi),this},scale:function(t,e,n){return Fi.makeScale(t,e,n),this.applyMatrix4(Fi),this},lookAt:function(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],r=e.toJSON(t.data);""!==e.name&&(r.name=e.name),t.data.attributes[a]=r}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ki).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const l in r){const t=r[l];this.setAttribute(l,t.clone(e))}const i=t.morphAttributes;for(const l in i){const t=[],n=i[l];for(let r=0,i=n.length;rn.far?null:{distance:c,point:ss.clone(),object:t}}function ls(t,e,n,r,i,s,o,a,l,c,h,u){qi.fromBufferAttribute(i,c),Xi.fromBufferAttribute(i,h),Yi.fromBufferAttribute(i,u);const p=t.morphTargetInfluences;if(e.morphTargets&&s&&p){Ki.set(0,0,0),$i.set(0,0,0),ts.set(0,0,0);for(let t=0,e=s.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(i),!1===t.ray.intersectsSphere(ji))return;if(Vi.copy(i).invert(),Wi.copy(t.ray).applyMatrix4(Vi),null!==n.boundingBox&&!1===Wi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;n0?1:-1,c.push(A.x,A.y,A.z),h.push(a/f),h.push(1-o/g),T+=1}}for(let o=0;o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},gs.prototype=Object.assign(Object.create(Xr.prototype),{constructor:gs,isCamera:!0,copy:function(t,e){return Xr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),xs.prototype=Object.assign(Object.create(gs.prototype),{constructor:xs,isPerspectiveCamera:!0,copy:function(t,e){return gs.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xr.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const vs=90,ys=1;class _s extends Xr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new xs(vs,ys,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(1,0,0)),this.add(r);const i=new xs(vs,ys,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(-1,0,0)),this.add(i);const s=new xs(vs,ys,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Yn(0,1,0)),this.add(s);const o=new xs(vs,ys,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Yn(0,-1,0)),this.add(o);const a=new xs(vs,ys,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const l=new xs(vs,ys,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Yn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}exports.CubeCamera=_s;class bs extends kn{constructor(t,e,n,r,i,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:nt,n,r,i,s,o=void 0!==o?o:Bt,a,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}exports.CubeTexture=bs,bs.prototype.isCubeTexture=!0;class ws extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bs(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:gt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Nt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new cs(5,5,5),i=new fs({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});i.uniforms.tEquirect.value=e;const s=new os(r,i),o=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new _s(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}exports.WebGLCubeRenderTarget=ws,ws.prototype.isWebGLCubeRenderTarget=!0;class Ms extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ut,this.minFilter=void 0!==c?c:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}exports.DataTexture=Ms,Ms.prototype.isDataTexture=!0;const Ss=new dr,Ts=new Yn;class Es{constructor(t=new Qr,e=new Qr,n=new Qr,r=new Qr,i=new Qr,s=new Qr){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],m=n[11],f=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(o-r,h-a,m-u,v-f).normalize(),e[1].setComponents(o+r,h+a,m+u,v+f).normalize(),e[2].setComponents(o+i,h+l,m+p,v+g).normalize(),e[3].setComponents(o-i,h-l,m-p,v-g).normalize(),e[4].setComponents(o-s,h-c,m-d,v-x).normalize(),e[5].setComponents(o+s,h+c,m+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version=0){const s=l[e];if(void 0!==s){const e=s.normalized,i=s.itemSize,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(f(r,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r+0,1),f(r+1,1),f(r+2,1),f(r+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r+0,4,o,!1,64,0),t.vertexAttribPointer(r+1,4,o,!1,64,16),t.vertexAttribPointer(r+2,4,o,!1,64,32),t.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)u(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function rl(t,e,n,r){const i=r.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,r){t.drawArrays(s,e,r),n.update(r,s,1)},this.renderInstances=function(r,o,a){if(0===a)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,r,o,a),n.update(o,s,a)}}function il(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=s||e.has("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:s?t.getParameter(36183):0}}function sl(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Qr,a=new zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==i||null===c){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length0){const o=t.getRenderTarget(),a=new ws(s.height/2);return a.fromEquirectangularTexture(t,i),e.set(i,a),t.setRenderTarget(o),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function al(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ll(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e65535?Li:Ei)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===i[e.id]?e:(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n0)return t;const i=e*n;let s=bl[i];if(void 0===s&&(s=new Float32Array(i),bl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function Al(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n/gm;function Rc(t){return t.replace(Lc,Cc)}function Cc(t,e){const n=Ka[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Pc=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Dc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ic(t){return t.replace(Dc,Nc).replace(Pc,Bc)}function Bc(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nc(t,e,n,r)}function Nc(t,e,n,r){let i="";for(let s=parseInt(e);s0?t.gammaFactor:1,d=n.isWebGL2?"":wc(n),m=Mc(s),f=i.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[m].filter(Tc).join("\n")).length>0&&(g+="\n"),(x=[d,m].filter(Tc).join("\n")).length>0&&(x+="\n")):(g=[Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Tc).join("\n"),x=[d,Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?Ka.tonemapping_pars_fragment:"",n.toneMapping!==Z?bc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ka.encodings_pars_fragment,n.map?yc("mapTexelToLinear",n.mapEncoding):"",n.matcap?yc("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?yc("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?yc("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?yc("lightMapTexelToLinear",n.lightMapEncoding):"",_c("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Tc).join("\n")),o=Ac(o=Ec(o=Rc(o),n),n),a=Ac(a=Ec(a=Rc(a),n),n),o=Ic(o),a=Ic(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const y=v+x+a,_=mc(i,35633,v+g+o),b=mc(i,35632,y);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(f).trim(),e=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const e=vc(i,_,"vertex"),n=vc(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new dc(i,f)),w},this.getAttributes=function(){return void 0===M&&(M=Sc(i,f)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=fc++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}function kc(t,e,n,r,i,s){const o=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let m=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(i,o,g,v,y){const _=v.fog,b=i.isMeshStandardMaterial?v.environment:null,w=e.get(i.envMap||b),M=f[i.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===d,flipSided:i.side===p,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&r.sort(t||Wc),i.length>1&&i.sort(e||jc)}}}function Xc(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new qc(t),e.set(n,[i])):r>=e.get(n).length?(i=new qc(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new xi};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Zc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Jc=0;function Qc(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Kc(t,e){const n=new Yc,r=Zc(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)i.probe.push(new Yn);const s=new Yn,o=new wr,a=new wr;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,h=0,u=0,p=0,d=0,m=0,f=0,g=0;s.sort(Qc);for(let t=0,e=s.length;t0&&(e.isWebGL2?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=$a.LTC_HALF_1,i.rectAreaLTC2=$a.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=a,i.ambient[2]=l;const x=i.hash;x.directionalLength===c&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===m&&x.numPointShadows===f&&x.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=p,i.point.length=h,i.hemi.length=d,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=f,i.spotShadowMatrix.length=g,x.directionalLength=c,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=m,x.numPointShadows=f,x.numSpotShadows=g,i.version=Jc++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p=n.get(r).length?(s=new $c(t,e),n.get(r).push(s)):s=n.get(r)[i],s},dispose:function(){n=new WeakMap}}}class eh extends hi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}exports.MeshDepthMaterial=eh,eh.prototype.isMeshDepthMaterial=!0;class nh extends hi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}exports.MeshDistanceMaterial=nh,nh.prototype.isMeshDistanceMaterial=!0;var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ih="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let r=new Es;const i=new On,s=new On,o=new Wn,a=[],c=[],m={},f={0:p,1:u,2:d},x=new fs({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new On},radius:{value:4}},vertexShader:ih,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new ki;y.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new os(y,x),b=this;function w(n,r){const i=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,_,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=a[r];return void 0===i&&(i=new eh({depthPacking:nn,morphTargets:t,skinning:e}),a[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=c[r];return void 0===i&&(i=new nh({morphTargets:t,skinning:e}),c[r]=i),i}function T(e,n,r,i,s,o,a){let l=null,c=M,u=e.customDepthMaterial;if(!0===i.isPointLight&&(c=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(t,i,!0===e.isInstancedMesh)}else l=u;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=a===h?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=s,l.farDistance=o),l}function E(n,i,s,o,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;ln||i.y>n)&&(i.x>n&&(s.x=Math.floor(n/p.x),i.x=s.x*p.x,u.mapSize.x=s.x),i.y>n&&(s.y=Math.floor(n/p.y),i.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new jn(i.x,i.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(ot=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),st=ot>=2);let lt=null,ct={};const ht=new Wn,ut=new Wn;function pt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;or||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Fn.floorPowerOfTwo:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===d&&(d=f(s,o));const a=n?f(s,o):d;return a.width=s,a.height=o,a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,i,s){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,s))}function _(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function b(t){return t===ut||t===pt||t===mt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),s=r.get(n);if(!e)return;void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function E(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;C(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=o||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const u=h[0],p=x(u)||a,d=s.convert(r.format),m=s.convert(r.type),f=_(r.internalFormat,d,m);let b;if(R(34067,r,p),o){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),o.memory.textures++)}function P(e,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==ut&&t.minFilter!==gt)}(r)&&!1===x(r.image),c=g(r.image,l,!1,h),u=x(c)||a,p=s.convert(r.format);let d,m=s.convert(r.type),f=_(r.internalFormat,p,m);R(o,r,u);const b=r.mipmaps;if(r.isDepthTexture)f=6402,a?f=r.type===At?36012:r.type===Et?33190:r.type===Dt?35056:33189:r.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===f&&r.type!==St&&r.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=St,m=s.convert(r.type)),r.format===Ht&&6402===f&&(f=34041,r.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Dt,m=s.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t0&&u){for(let t=0,e=b.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,p=i.isDataTexture3D||i.isDataTexture2DArray,d=x(e)||a;if(!a||i.format!==Bt||i.type!==At&&i.type!==Lt||(i.format=Nt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(i.format),r=s.convert(i.type),o=_(i.internalFormat,n,r),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),I(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),R(34067,i,d);for(let t=0;t<6;t++)D(l.__webglFramebuffer[t],e,36064,34069+t);v(i,d)&&y(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;p&&(a?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),R(t,i,d),D(l.__webglFramebuffer,e,36064,t),v(i,d)&&y(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const i=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;n.bindTexture(i,s),y(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===It)return 6406;if(t===Bt)return 6407;if(t===Nt)return 6408;if(t===Ft)return 6409;if(t===Ot)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===re)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===re)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ie||t===se||t===oe||t===ae||t===le||t===ce||t===he||t===ue||t===pe||t===de||t===me||t===fe||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(t=[]){xs.call(this),this.cameras=t}ch.prototype=Object.assign(Object.create(xs.prototype),{constructor:ch,isArrayCamera:!0});class hh extends Xr{constructor(){super(),this.type="Group"}}function uh(){this._targetRay=null,this._grip=null,this._hand=null}function ph(t,e){const n=this;let r=null,i=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new xs;h.layers.enable(1),h.viewport=new Wn;const u=new xs;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new ch;d.layers.enable(1),d.layers.enable(2);let m=null,f=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){c.forEach(function(t,e){t.disconnect(e)}),c.clear(),m=null,f=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=r.inputSources;for(let n=0;n0&&wt(s,t,e),o.length>0&&wt(o,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==_&&(X.updateRenderTargetMipmap(_),X.updateMultisampleRenderTarget(_)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,d.pop(),u=d.length>0?d[d.length-1]:null},this.setFramebuffer=function(t){x!==t&&null===_&&ht.bindFramebuffer(36160,t),x=t},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=x,i=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=o[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),E=t.scissorTest}else S.copy(D).multiplyScalar(R).floor(),T.copy(I).multiplyScalar(R).floor(),E=B;if(b!==r&&(ht.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(T),W.setScissorTest(E),i){const r=q.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(s){const r=q.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==b&&(ht.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Nt&<.convert(l)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===Lt&&(k.has("EXT_color_buffer_half_float")||V.isWebGL2&&k.has("EXT_color_buffer_float"));if(!(c===bt||lt.convert(c)===ht.getParameter(35738)||c===At&&(V.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ht.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),o=lt.convert(e.format);X.setTexture2D(e,0),ht.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=lt.convert(n.format),a=lt.convert(n.type);X.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let h;if(r.isDataTexture3D)X.setTexture3D(r,0),h=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),h=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const u=ht.getParameter(3314),p=ht.getParameter(32878),d=ht.getParameter(3316),m=ht.getParameter(3315),g=ht.getParameter(32877);ht.pixelStorei(3314,s),ht.pixelStorei(32878,o),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),ht.texSubImage3D(h,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,a),ht.pixelStorei(3314,u),ht.pixelStorei(32878,p),ht.pixelStorei(3316,d),ht.pixelStorei(3315,m),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(h),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}exports.Group=hh,hh.prototype.isGroup=!0,Object.assign(uh.prototype,{constructor:uh,getHandSpace:function(){return null===this._hand&&(this._hand=new hh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new hh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new hh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new hh;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const r=l.joints[s.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),this}}),Object.assign(ph.prototype,In.prototype);class gh extends fh{}exports.WebGL1Renderer=gh,gh.prototype.isWebGL1Renderer=!0;class xh{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new xh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=xh,xh.prototype.isFogExp2=!0;class vh{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new vh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=vh,vh.prototype.isFog=!0;class yh extends Xr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function _h(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}exports.Scene=yh,yh.prototype.isScene=!0,Object.defineProperty(_h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_h.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;rt.far||e.push({distance:a,point:Th.clone(),uv:li.getUV(Th,Ph,Dh,Ih,Bh,Nh,Fh,new On),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function zh(t,e,n,r,i,s){Lh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Rh.x=s*Lh.x-i*Lh.y,Rh.y=i*Lh.x+s*Lh.y):Rh.copy(Lh),t.copy(e),t.x+=Rh.x,t.y+=Rh.y,t.applyMatrix4(Ch)}exports.Sprite=Oh,Oh.prototype.isSprite=!0;const Gh=new Yn,Hh=new Yn;class Uh extends Xr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n0){let n,r;for(n=1,r=e.length;n0){Gh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Gh);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Gh.setFromMatrixPosition(t.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=Gh.distanceTo(Hh)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;ro)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);pt.far||e.push({distance:p,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,s=i.count-1;no)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const hu=new Yn,uu=new Yn;function pu(t,e){cu.call(this,t,e),this.type="LineSegments"}pu.prototype=Object.assign(Object.create(cu.prototype),{constructor:pu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;ti.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}yu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:yu,isPoints:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xu.copy(n.boundingSphere),xu.applyMatrix4(r),xu.radius+=i,!1===t.ray.intersectsSphere(xu))return;fu.copy(r).invert(),gu.copy(t.ray).applyMatrix4(fu);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class bu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.format=void 0!==o?o:Bt,this.minFilter=void 0!==s?s:gt,this.magFilter=void 0!==i?i:gt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}exports.VideoTexture=bu,bu.prototype.isVideoTexture=!0;class wu extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}exports.CompressedTexture=wu,wu.prototype.isCompressedTexture=!0;class Mu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.needsUpdate=!0}}exports.CanvasTexture=Mu,Mu.prototype.isCanvasTexture=!0;class Su extends kn{constructor(t,e,n,r,i,s,o,a,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=St),void 0===n&&c===Ht&&(n=Dt),super(null,r,i,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}}exports.DepthTexture=Su,Su.prototype.isDepthTexture=!0;class Tu extends ki{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],l=new Yn,c=new On;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const i=n+h/e*r;l.x=t*Math.cos(i),l.y=t*Math.sin(i),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[u]/t+1)/2,c.y=(s[u+1]/t+1)/2,a.push(c.x,c.y)}for(let h=1;h<=e;h++)i.push(h,h+1,0);this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("normal",new Ci(o,3)),this.setAttribute("uv",new Ci(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Tu;class Eu extends ki{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],h=[],u=[],p=[];let d=0;const m=[],f=n/2;let g=0;function x(n){const i=d,s=new On,m=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=r;t++)h.push(0,f*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=r;t++){const e=t/r*a+o,n=Math.cos(e),i=Math.sin(e);m.x=v*i,m.y=f*y,m.z=v*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*i*y+.5,p.push(s.x,s.y),d++}for(let t=0;t0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Eu;class Au extends Eu{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}}exports.ConeGeometry=exports.ConeBufferGeometry=Au;class Lu extends ki{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),l=i-o;for(let t=0;t<=l;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/l)}for(let o=0;o.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(i.slice(),3)),this.setAttribute("uv",new Ci(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Lu;class Ru extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Ru;const Cu=new Yn,Pu=new Yn,Du=new Yn,Iu=new li;class Bu extends ki{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Fn.DEG2RAD*e),i=t.getIndex(),s=t.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let p=0;p80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),p>h&&(h=p);d=0!==(d=Math.max(c-a,h-l))?1/d:0}return zu(s,o,n,a,l,d),o}};function Fu(t,e,n,r,i){let s,o;if(i===pp(t,e,n,r)>0)for(s=e;s=e;s-=r)o=cp(s,t[s],t[s+1],o);return o&&ep(o,o.next)&&(hp(o),o=o.next),o}function Ou(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!ep(r,r.next)&&0!==tp(r.prev,r,r.next))r=r.next;else{if(hp(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zu(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yu(t,r,i,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hu(t,r,i,s):Gu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),hp(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?zu(t=Uu(Ou(t),e,n),e,n,r,i,s,2):2===o&&ku(t,e,n,r,i,s):zu(Ou(t),e,n,r,i,s,1);break}}function Gu(t){const e=t.prev,n=t,r=t.next;if(tp(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ku(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&tp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Hu(t,e,n,r){const i=t.prev,s=t,o=t.next;if(tp(i,s,o)>=0)return!1;const a=i.xs.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,h=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=Ju(a,l,e,n,r),p=Ju(c,h,e,n,r);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Uu(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!ep(i,s)&&np(i,r,r.next,s)&&op(i,s)&&op(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),hp(r),hp(r.next),r=t=s),r=r.next}while(r!==t);return Ou(r)}function ku(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&$u(o,t)){let a=lp(o,t);return o=Ou(o,o.next),a=Ou(a,a.next),zu(o,e,n,r,i,s),void zu(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function Vu(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&r!==n.x&&Ku(is.x||n.x===s.x&&Xu(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}function Xu(t,e){return tp(t.prev,t,e.prev)<0&&tp(e.next,t,t.next)<0}function Yu(t,e,n,r){let i=t;do{null===i.z&&(i.z=Ju(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zu(i)}function Zu(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function Ju(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Qu(t){let e=t,n=t;do{(e.x=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function $u(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(op(t,e)&&op(e,t)&&ap(t,e)&&(tp(t.prev,t,e.prev)||tp(t,e.prev,e))||ep(t,e)&&tp(t.prev,t,t.next)>0&&tp(e.prev,e,e.next)>0)}function tp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ep(t,e){return t.x===e.x&&t.y===e.y}function np(t,e,n,r){const i=ip(tp(t,e,n)),s=ip(tp(t,e,r)),o=ip(tp(n,r,t)),a=ip(tp(n,r,e));return i!==s&&o!==a||(!(0!==i||!rp(t,n,e))||(!(0!==s||!rp(t,r,e))||(!(0!==o||!rp(n,t,r))||!(0!==a||!rp(n,e,r)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ip(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&np(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function op(t,e){return tp(t.prev,t,t.next)<0?tp(t,e,t.next)>=0&&tp(t,t.prev,e)>=0:tp(t,e,t.prev)<0||tp(t,t.next,e)<0}function ap(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function lp(t,e){const n=new up(t.i,t.x,t.y),r=new up(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cp(t,e,n,r){const i=new up(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function hp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function up(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pp(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function fp(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(l*l+c*c),d=e.x-a/u,m=e.y+o/u,f=((n.x-c/p-d)*c-(n.y+l/p-m)*l)/(o*c-a*l),g=(r=d+o*f-t.x)*r+(i=m+a*f-t.y)*i;if(g<=2)return new On(r,i);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(h)):(r=o,i=a,s=Math.sqrt(h/2))}return new On(r/s,i/s)}const P=[];for(let e=0,n=E.length,r=n-1,i=e+1;e=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*d;t=0?(t(p-1e-5,r,c),h.subVectors(l,c)):(t(p+1e-5,r,c),h.subVectors(c,l)),r-1e-5>=0?(t(p,r-1e-5,c),u.subVectors(l,c)):(t(p,r+1e-5,c),u.subVectors(c,l)),a.crossVectors(h,u).normalize(),s.push(a.x,a.y,a.z),o.push(p,r)}}for(let d=0;d0)&&p.push(e,r,o),(g!==n-1||a=r)){a.push(t.times[s]);for(let n=0;ns.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=e.times[u]){const t=u*l+a,n=t+l-a;p=jp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=l-a;t.evaluate(s),p=jp.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=i.times.length;for(let t=0;t=i)break t;{const o=e[1];t=(i=e[--n-1]))break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==i||s!==r){i>=s&&(i=(s=Math.max(s,1))-1);const t=this.getValueSize();this.times=jp.arraySlice(n,i,s),this.values=jp.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&jp.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=jp.arraySlice(this.times),e=jp.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===ze,i=t.length-1;let s=1;for(let o=1;o0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=jp.arraySlice(t,0,s),this.values=jp.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=jp.arraySlice(this.times,0),e=jp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}exports.KeyframeTrack=Jp,Jp.prototype.TimeBufferType=Float32Array,Jp.prototype.ValueBufferType=Float32Array,Jp.prototype.DefaultInterpolation=Oe;class Qp extends Jp{}exports.BooleanKeyframeTrack=Qp,Qp.prototype.ValueTypeName="bool",Qp.prototype.ValueBufferType=Array,Qp.prototype.DefaultInterpolation=Fe,Qp.prototype.InterpolantFactoryMethodLinear=void 0,Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends Jp{}exports.ColorKeyframeTrack=Kp,Kp.prototype.ValueTypeName="color";class $p extends Jp{}function td(t,e,n,r){qp.call(this,t,e,n,r)}exports.NumberKeyframeTrack=$p,$p.prototype.ValueTypeName="number",td.prototype=Object.assign(Object.create(qp.prototype),{constructor:td,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let l=t*o;for(let c=l+o;l!==c;l+=4)Xn.slerpFlat(i,0,s,l-o,s,l,a);return i}});class ed extends Jp{InterpolantFactoryMethodLinear(t){return new td(this.times,this.values,this.getValueSize(),t)}}exports.QuaternionKeyframeTrack=ed,ed.prototype.ValueTypeName="quaternion",ed.prototype.DefaultInterpolation=Oe,ed.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends Jp{}exports.StringKeyframeTrack=nd,nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=Fe,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends Jp{}exports.VectorKeyframeTrack=rd,rd.prototype.ValueTypeName="vector";class id{constructor(t,e=-1,n,r=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Fn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(od(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(Jp.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];jp.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let c=0;c0||0===t.search(/^data\:image\/jpeg/);i.format=r?Bt:Nt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(yd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)i+=(n=this.getPoint(s/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,l=i-1;for(;a<=l;)if((o=n[r=Math.floor(a+(l-a)/2)]-s)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(i-1);const c=n[r];return(r+(s-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),s=this.getPoint(r),o=e||(i.isVector2?new On:new Yn);return o.copy(s).sub(i).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,r=[],i=[],s=[],o=new Yn,a=new wr;for(let p=0;p<=t;p++){const e=p/t;r[p]=this.getTangentAt(e,new Yn),r[p].normalize()}i[0]=new Yn,s[0]=new Yn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let p=1;p<=t;p++){if(i[p]=i[p-1].clone(),s[p]=s[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Fn.clamp(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(a.makeRotationAxis(o,t))}s[p].crossVectors(r[p],i[p])}if(!0===e){let e=Math.acos(Fn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class _d extends yd{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new On,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?o=r[(l-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),o=Md);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return n.set(Ld(o,a.x,l.x,c.x,h.x),Ld(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[r]-e,i=this.curves[r],s=i.getLength(),o=0===s?0:1-t/s;return i.getPointAt(o)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}exports.Path=Xd;class Yd extends Xd{constructor(t){super(t),this.uuid=Fn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new xi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new On).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new Yn).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Wn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new zn).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new wr).fromArray(e.value);break;default:r.uniforms[i].value=e.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const i in t.extensions)r.extensions[i]=t.extensions[i];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new On).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new On).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}exports.MaterialLoader=fm;const gm={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r0){const n=new ld(e);(i=new fd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[i],l=-l),t.yo.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=dp.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],(l=new Yd).curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let x=0,v=s.length;x1){let t=!1;const e=[];for(let n=0,r=p.length;n0&&(t||(f=u))}for(let x=0,v=p.length;x0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,l=e+e;a!==l;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){Xn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;Xn.multiplyQuaternionsFlat(t,s,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}exports.PropertyMixer=Km;const $m="\\[\\]\\.:\\/",tf=new RegExp("[\\[\\]\\.:\\/]","g"),ef="[^\\[\\]\\.:\\/]",nf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",rf=/((?:WC+[\/:])*)/.source.replace("WC",ef),sf=/(WCOD+)?/.source.replace("WCOD",nf),of=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ef),af=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ef),lf=new RegExp("^"+rf+sf+of+af+"$"),cf=["material","materials","bones"];function hf(t,e,n){const r=n||uf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function uf(t,e,n){this.path=e,this.parsedPath=n||uf.parseTrackName(e),this.node=uf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(hf.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(uf,{Composite:hf,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new uf.Composite(t,e,n):new uf(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(tf,"")},parseTrackName:function(t){const e=lf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==cf.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r=i){const s=i++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[l];e[l]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(h);for(let u=c,p=a.length;u!==p;++u){const n=a[u];h[u]=new uf(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}exports.AnimationObjectGroup=pf,pf.prototype.isAnimationObjectGroup=!0;class df{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:Ge,endingEnd:Ge};for(let l=0;l!==s;++l){const t=i[l].createInterpolant(null);o[l]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Be,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=i,a[1]=i+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case ke:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===Ne;if(0===t)return-1===i?r:s&&1==(1&i)?e-r:r;if(n===Ie){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=He,r.endingEnd=He):(r.endingStart=t?this.zeroSlopeAtStart?He:Ge:Ue,r.endingEnd=e?this.zeroSlopeAtEnd?He:Ge:Ue)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class mf extends In{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let h=0;h!==i;++h){const t=r[h],i=t.name;let l=c[i];if(void 0!==l)s[h]=l;else{if(void 0!==(l=s[h])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,i));continue}const r=e&&e._propertyBindings[h].binding.parsedPath;++(l=new Km(uf.create(n,i,r),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(l,a,i),s[h]=l}o[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l){e[l]._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let l=0;l!==a;++l)o[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new On),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new On),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Mf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=Sf,Sf.prototype.isBox2=!0;const Tf=new Yn,Ef=new Yn;class Af{constructor(t=new Yn,e=new Yn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tf.subVectors(t,this.start),Ef.subVectors(this.end,this.start);const n=Ef.dot(Ef);let r=Ef.dot(Tf)/n;return e&&(r=Fn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Lf(t){Xr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=Af,Lf.prototype=Object.create(Xr.prototype),Lf.prototype.constructor=Lf,Lf.prototype.isImmediateRenderObject=!0;const Rf=new Yn;class Cf extends Xr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ki,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,o=1,a=32;s.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eg,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=ig;class sg extends pu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ki;n.setAttribute("position",new Ci(e,3)),n.setAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=sg;const og=new Float32Array(1),ag=new Int32Array(og.buffer),lg={toHalfFloat:function(t){og[0]=t;const e=ag[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}};exports.DataUtils=lg;const cg=4,hg=8,ug=Math.pow(2,hg),pg=[.125,.215,.35,.446,.526,.582],dg=hg-cg+1+pg.length,mg=20,fg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},gg=new vi({side:p,depthWrite:!1,depthTest:!1}),xg=new os(new cs,gg),vg=new lm,{_lodPlanes:yg,_sizeLods:_g,_sigmas:bg}=Cg(),wg=new xi;let Mg=null;const Sg=(1+Math.sqrt(5))/2,Tg=1/Sg,Eg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Sg,Tg),new Yn(0,Sg,-Tg),new Yn(Tg,0,Sg),new Yn(-Tg,0,Sg),new Yn(Sg,Tg,0),new Yn(-Sg,Tg,0)];function Ag(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Lg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Ig(mg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Mg=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ng(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?ug:0,ug,ug),a.setRenderTarget(r),u&&a.render(xg,i),a.render(t,i)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ng()):null==this._equirectShader&&(this._equirectShader=Bg());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new os(yg[0],r),s=r.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=fg[t.encoding],s.outputEncoding.value=fg[e.texture.encoding],Dg(e,0,0,3*ug,2*ug),n.setRenderTarget(e),n.render(i,vg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;rmg&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${mg}`);const f=[];let g=0;for(let v=0;vhg-cg?r-hg+cg:0),3*x,2*x),a.setRenderTarget(e),a.render(c,vg)}}function Rg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Cg(){const t=[],e=[],n=[];let r=hg;for(let i=0;ihg-cg?o=pg[i-hg+cg-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),x=new Float32Array(m*p*u),v=new Float32Array(f*p*u);for(let t=0;t2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*p*t),x.set(h,m*p*t);const i=[t,t,t,t,t,t];v.set(i,f*p*t)}const y=new ki;y.setAttribute("position",new bi(g,d)),y.setAttribute("uv",new bi(x,m)),y.setAttribute("faceIndex",new bi(v,f)),t.push(y),r>cg&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pg(t){const e=new jn(3*ug,3*ug,t);return e.texture.mapping=ot,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dg(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ig(t){const e=new Float32Array(t),n=new Yn(0,1,0);return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Og()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Bg(){const t=new On(1,1);return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Og()}\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Ng(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Og()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Fg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Og(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}exports.PMREMGenerator=Lg;const zg=0;exports.LineStrip=0;const Gg=1;exports.LinePieces=1;const Hg=0;exports.NoColors=0;const Ug=1;exports.FaceColors=1;const kg=2;function Vg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Wg(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function jg(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yu(t,e)}function qg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Oh(t)}function Xg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yu(t,e)}function Yg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Zg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Jg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Qg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Kg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new bi(t,e).setUsage(Mn)}function $g(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wi(t,e)}function tx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mi(t,e)}function ex(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function nx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ti(t,e)}function rx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ei(t,e)}function ix(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ai(t,e)}function sx(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Li(t,e)}function ox(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function ax(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Pi(t,e)}function lx(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new sg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Kf(t,e)}function hx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pu(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pu(new Dp(t.geometry),new ru({color:void 0!==e?e:16777215}))}function px(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pd(t)}function dx(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xd(t)}function mx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ws(t,n)}function fx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.VertexColors=2,yd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(yd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hd.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gm.extractUrlBase(t)},hd.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Sf.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Sf.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Sf.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sf.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Qn.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},dr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Af.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Fn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Fn.floorPowerOfTwo(t)},Fn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Fn.ceilPowerOfTwo(t)},zn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},zn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},zn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},zn.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wr.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},wr.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},wr.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},wr.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},wr.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},wr.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},wr.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},wr.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},wr.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},wr.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},wr.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},wr.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},wr.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},wr.prototype.makeFrustum=function(t,e,n,r,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,s)},wr.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Qr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Xn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Xn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},br.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},br.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},br.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},li.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},li.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},li.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},li.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},li.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},li.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),li.getBarycoord(t,e,n,r,i)},li.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),li.getNormal(t,e,n,r)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Sp(this,t)},On.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},On.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},On.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Yn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Yn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Yn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Yn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Yn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Yn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Yn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Yn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Yn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Wn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),os.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(os.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Uh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Qh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Xh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(yd.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),xs.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zd.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(bi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),bi.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},bi.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},bi.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ki.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ki.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new bi(arguments[1],arguments[2])))},ki.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ki.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ki.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ki.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ki.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ki.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(xm.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(vf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(_h.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),_h.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},_h.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},gp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},gp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},yh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(ff.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(hi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(zp.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Op.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(fs.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),fh.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},fh.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},fh.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},fh.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},fh.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},fh.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},fh.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},fh.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},fh.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},fh.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},fh.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},fh.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},fh.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},fh.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},fh.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},fh.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},fh.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},fh.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},fh.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},fh.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},fh.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},fh.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},fh.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},fh.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},fh.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(fh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(jm.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Dm).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_s.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},_s.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new vd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new gd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126"); },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"uNJb":[function(require,module,exports) { "use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(n){switch(t(n)){case"number":return 8;case"string":return 2*n.length;case"boolean":return 4;default:return 0}}function e(t){return/(Uint|Int|Float)(8|16|32)Array/.test(t.constructor.name)}function r(t,n){var e={total:0,depth:{min:1/0,max:-1/0},tris:{min:1/0,max:-1/0},splits:[0,0,0]};return t.traverse(function(t,n,r,o,i){e.total++,n?(e.depth.min=Math.min(t,e.depth.min),e.depth.max=Math.max(t,e.depth.max),e.tris.min=Math.min(i,e.tris.min),e.tris.max=Math.max(i,e.tris.max)):e.splits[o]++},n),e.tris.min===1/0&&(e.tris.min=0,e.tris.max=0),e.depth.min===1/0&&(e.depth.min=0,e.depth.max=0),e}function o(t){return t._roots.map(function(n,e){return r(t,e)})}function i(r){for(var o=new Set,i=[r],a=0;i.length;){var s=i.pop();if(!o.has(s))for(var m in o.add(s),s)if(s.hasOwnProperty(m)){a+=n(m);var u=s[m];!u||"object"!==t(u)&&"function"!=typeof u?a+=n(u):e(u)?a+=u.byteLength:u instanceof ArrayBuffer?a+=u.byteLength:i.push(u)}}return a}Object.defineProperty(exports,"__esModule",{value:!0}),exports.estimateMemoryInBytes=i,exports.getBVHExtremes=o; },{}],"HxoX":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MeshBVHDebug=void 0;var e=require("three"),t=require("./Utils/ArrayBoxUtilities.js");function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;rS.raycasters.count;)v.pop().remove();for(;v.lengthS.mesh.count;)y.remove(z.pop());for(;z.length=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} +},{}],"H4B8":[function(require,module,exports) { +"use strict";require("core-js/modules/es6.array.copy-within.js"),require("core-js/modules/es6.array.fill.js"),require("core-js/modules/es6.array.filter.js"),require("core-js/modules/es6.array.find.js"),require("core-js/modules/es6.array.find-index.js"),require("core-js/modules/es7.array.flat-map.js"),require("core-js/modules/es6.array.from.js"),require("core-js/modules/es7.array.includes.js"),require("core-js/modules/es6.array.iterator.js"),require("core-js/modules/es6.array.map.js"),require("core-js/modules/es6.array.of.js"),require("core-js/modules/es6.array.slice.js"),require("core-js/modules/es6.array.sort.js"),require("core-js/modules/es6.array.species.js"),require("core-js/modules/es6.date.to-primitive.js"),require("core-js/modules/es6.function.has-instance.js"),require("core-js/modules/es6.function.name.js"),require("core-js/modules/es6.map.js"),require("core-js/modules/es6.math.acosh.js"),require("core-js/modules/es6.math.asinh.js"),require("core-js/modules/es6.math.atanh.js"),require("core-js/modules/es6.math.cbrt.js"),require("core-js/modules/es6.math.clz32.js"),require("core-js/modules/es6.math.cosh.js"),require("core-js/modules/es6.math.expm1.js"),require("core-js/modules/es6.math.fround.js"),require("core-js/modules/es6.math.hypot.js"),require("core-js/modules/es6.math.imul.js"),require("core-js/modules/es6.math.log1p.js"),require("core-js/modules/es6.math.log10.js"),require("core-js/modules/es6.math.log2.js"),require("core-js/modules/es6.math.sign.js"),require("core-js/modules/es6.math.sinh.js"),require("core-js/modules/es6.math.tanh.js"),require("core-js/modules/es6.math.trunc.js"),require("core-js/modules/es6.number.constructor.js"),require("core-js/modules/es6.number.epsilon.js"),require("core-js/modules/es6.number.is-finite.js"),require("core-js/modules/es6.number.is-integer.js"),require("core-js/modules/es6.number.is-nan.js"),require("core-js/modules/es6.number.is-safe-integer.js"),require("core-js/modules/es6.number.max-safe-integer.js"),require("core-js/modules/es6.number.min-safe-integer.js"),require("core-js/modules/es6.number.parse-float.js"),require("core-js/modules/es6.number.parse-int.js"),require("core-js/modules/es6.object.assign.js"),require("core-js/modules/es7.object.define-getter.js"),require("core-js/modules/es7.object.define-setter.js"),require("core-js/modules/es7.object.entries.js"),require("core-js/modules/es6.object.freeze.js"),require("core-js/modules/es6.object.get-own-property-descriptor.js"),require("core-js/modules/es7.object.get-own-property-descriptors.js"),require("core-js/modules/es6.object.get-own-property-names.js"),require("core-js/modules/es6.object.get-prototype-of.js"),require("core-js/modules/es7.object.lookup-getter.js"),require("core-js/modules/es7.object.lookup-setter.js"),require("core-js/modules/es6.object.prevent-extensions.js"),require("core-js/modules/es6.object.to-string.js"),require("core-js/modules/es6.object.is.js"),require("core-js/modules/es6.object.is-frozen.js"),require("core-js/modules/es6.object.is-sealed.js"),require("core-js/modules/es6.object.is-extensible.js"),require("core-js/modules/es6.object.keys.js"),require("core-js/modules/es6.object.seal.js"),require("core-js/modules/es7.object.values.js"),require("core-js/modules/es6.promise.js"),require("core-js/modules/es7.promise.finally.js"),require("core-js/modules/es6.reflect.apply.js"),require("core-js/modules/es6.reflect.construct.js"),require("core-js/modules/es6.reflect.define-property.js"),require("core-js/modules/es6.reflect.delete-property.js"),require("core-js/modules/es6.reflect.get.js"),require("core-js/modules/es6.reflect.get-own-property-descriptor.js"),require("core-js/modules/es6.reflect.get-prototype-of.js"),require("core-js/modules/es6.reflect.has.js"),require("core-js/modules/es6.reflect.is-extensible.js"),require("core-js/modules/es6.reflect.own-keys.js"),require("core-js/modules/es6.reflect.prevent-extensions.js"),require("core-js/modules/es6.reflect.set.js"),require("core-js/modules/es6.reflect.set-prototype-of.js"),require("core-js/modules/es6.regexp.constructor.js"),require("core-js/modules/es6.regexp.flags.js"),require("core-js/modules/es6.regexp.match.js"),require("core-js/modules/es6.regexp.replace.js"),require("core-js/modules/es6.regexp.split.js"),require("core-js/modules/es6.regexp.search.js"),require("core-js/modules/es6.regexp.to-string.js"),require("core-js/modules/es6.set.js"),require("core-js/modules/es6.symbol.js"),require("core-js/modules/es7.symbol.async-iterator.js"),require("core-js/modules/es6.string.anchor.js"),require("core-js/modules/es6.string.big.js"),require("core-js/modules/es6.string.blink.js"),require("core-js/modules/es6.string.bold.js"),require("core-js/modules/es6.string.code-point-at.js"),require("core-js/modules/es6.string.ends-with.js"),require("core-js/modules/es6.string.fixed.js"),require("core-js/modules/es6.string.fontcolor.js"),require("core-js/modules/es6.string.fontsize.js"),require("core-js/modules/es6.string.from-code-point.js"),require("core-js/modules/es6.string.includes.js"),require("core-js/modules/es6.string.italics.js"),require("core-js/modules/es6.string.iterator.js"),require("core-js/modules/es6.string.link.js"),require("core-js/modules/es7.string.pad-start.js"),require("core-js/modules/es7.string.pad-end.js"),require("core-js/modules/es6.string.raw.js"),require("core-js/modules/es6.string.repeat.js"),require("core-js/modules/es6.string.small.js"),require("core-js/modules/es6.string.starts-with.js"),require("core-js/modules/es6.string.strike.js"),require("core-js/modules/es6.string.sub.js"),require("core-js/modules/es6.string.sup.js"),require("core-js/modules/es7.string.trim-left.js"),require("core-js/modules/es7.string.trim-right.js"),require("core-js/modules/es6.typed.array-buffer.js"),require("core-js/modules/es6.typed.int8-array.js"),require("core-js/modules/es6.typed.uint8-array.js"),require("core-js/modules/es6.typed.uint8-clamped-array.js"),require("core-js/modules/es6.typed.int16-array.js"),require("core-js/modules/es6.typed.uint16-array.js"),require("core-js/modules/es6.typed.int32-array.js"),require("core-js/modules/es6.typed.uint32-array.js"),require("core-js/modules/es6.typed.float32-array.js"),require("core-js/modules/es6.typed.float64-array.js"),require("core-js/modules/es6.weak-map.js"),require("core-js/modules/es6.weak-set.js"),require("core-js/modules/web.timers.js"),require("core-js/modules/web.immediate.js"),require("core-js/modules/web.dom.iterable.js");var e=n(require("stats.js")),r=u(require("dat.gui")),s=u(require("three")),o=n(require("../src/MeshBVHVisualizer.js")),t=require("../src/index.js");function i(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,s=new WeakMap;return(i=function(e){return e?s:r})(e)}function u(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var s=i(r);if(s&&s.has(e))return s.get(e);var o={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var n=t?Object.getOwnPropertyDescriptor(e,u):null;n&&(n.get||n.set)?Object.defineProperty(o,u,n):o[u]=e[u]}return o.default=e,s&&s.set(e,o),o}function n(e){return e&&e.__esModule?e:{default:e}}require("regenerator-runtime/runtime.js"),s.Mesh.prototype.raycast=t.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=t.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=t.disposeBoundsTree;var a=1251612,d=new s.WebGLRenderer({antialias:!0});d.setPixelRatio(window.devicePixelRatio),d.setSize(window.innerWidth,window.innerHeight),d.setClearColor(a,1),document.body.appendChild(d.domElement);var c=new s.Scene;c.fog=new s.Fog(1251612,20,60);var j=new s.DirectionalLight(16777215,.5);j.position.set(1,1,1),c.add(j),c.add(new s.AmbientLight(16777215,.4));var l=1,m=.4,p=400,q=100,h=null,y=new s.Object3D,f=new s.TorusKnotBufferGeometry(l,m,p,q),g=new s.MeshPhongMaterial({color:15277667});y.scale.multiplyScalar(10),c.add(y);var w=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50);w.position.z=40,w.far=100,w.updateProjectionMatrix();var b=new e.default;document.body.appendChild(b.dom);var v=[],x=new s.Raycaster,M=new s.SphereGeometry(.25,20,20),B=new s.CylinderGeometry(.02,.02),T=25,z=[],S={raycasters:{count:150,speed:1},mesh:{splitStrategy:t.CENTER,lazyGeneration:!0,count:1,useBoundsTree:!0,visualizeBounds:!1,speed:1,visualBoundsDepth:10}},C=null,E=0,P=function(){var e=new s.Mesh(f,g);e.rotation.x=10*Math.random(),e.rotation.y=10*Math.random(),z.push(e),y.add(e)},G=function(){var e=new s.Object3D,r=new s.MeshBasicMaterial({color:16777215}),o=new s.Mesh(M,r),t=new s.Mesh(M,r);t.scale.multiplyScalar(.5);var i=new s.Mesh(B,new s.MeshBasicMaterial({color:16777215,transparent:!0,opacity:.25}));e.add(i),e.add(o),e.add(t),c.add(e),o.position.set(T,0,0),e.rotation.x=10*Math.random(),e.rotation.y=10*Math.random();var u=new s.Vector3,n=new s.Vector3,a=Math.random()-.5,d=Math.random()-.5;v.push({update:function(){e.rotation.x+=1e-4*a*S.raycasters.speed*E,e.rotation.y+=1e-4*d*S.raycasters.speed*E,o.updateMatrixWorld(),u.setFromMatrixPosition(o.matrixWorld),n.copy(u).multiplyScalar(-1).normalize(),x.set(u,n),x.firstHitOnly=!0;var r=x.intersectObject(y,!0),s=r.length?r[0].distance:T;t.position.set(T-s,0,0),i.position.set(T-s/2,0,0),i.scale.set(1,s,1),i.rotation.z=Math.PI/2},remove:function(){c.remove(e)}})},k=function(){for(;v.length>S.raycasters.count;)v.pop().remove();for(;v.lengthS.mesh.count;)y.remove(z.pop());for(;z.lengthTHREE.js BVH Geometry Raycasting - \ No newline at end of file +THREE.js BVH Geometry Raycasting \ No newline at end of file diff --git a/example/bundle/sculpt.493e9c78.js b/example/bundle/sculpt.493e9c78.js index c362d6206..013f03786 100644 --- a/example/bundle/sculpt.493e9c78.js +++ b/example/bundle/sculpt.493e9c78.js @@ -2,7 +2,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var e=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e); },{}],"ss9A":[function(require,module,exports) { -var e=module.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e); +var e=module.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e); },{}],"M7z6":[function(require,module,exports) { module.exports=function(o){return"object"==typeof o?null!==o:"function"==typeof o}; },{}],"eT53":[function(require,module,exports) { @@ -31,7 +31,7 @@ var o=0,t=Math.random();module.exports=function(n){return"Symbol(".concat(void 0 module.exports=!1; },{}],"zGcK":[function(require,module,exports) { -var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"}); +var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"}); },{"./_core":"ss9A","./_global":"qf4T","./_library":"H21C"}],"d5RU":[function(require,module,exports) { module.exports=require("./_shared")("native-function-to-string",Function.toString); },{"./_shared":"zGcK"}],"PHot":[function(require,module,exports) { @@ -78,7 +78,11 @@ var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("spec var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)}; },{"./_array-species-constructor":"NNbH"}],"AuPh":[function(require,module,exports) { var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; -},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { +},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Hh2M":[function(require,module,exports) { +"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; +},{"./_fails":"BXiR"}],"GyG6":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(2);r(r.P+r.F*!require("./_strict-method")([].filter,!0),"Array",{filter:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"Qppk":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); },{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); @@ -134,20 +138,20 @@ var t=require("./_has"),e=require("./_to-object"),o=require("./_shared-key")("IE "use strict";var e=require("./_library"),r=require("./_export"),t=require("./_redefine"),i=require("./_hide"),n=require("./_iterators"),u=require("./_iter-create"),o=require("./_set-to-string-tag"),s=require("./_object-gpo"),a=require("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",l="keys",q="values",y=function(){return this};module.exports=function(_,p,h,k,v,w,d){u(h,p,k);var x,b,g,j=function(e){if(!c&&e in I)return I[e];switch(e){case l:case q:return function(){return new h(this,e)}}return function(){return new h(this,e)}},m=p+" Iterator",A=v==q,F=!1,I=_.prototype,O=I[a]||I[f]||v&&I[v],P=O||j(v),z=v?A?j("entries"):P:void 0,B="Array"==p&&I.entries||O;if(B&&(g=s(B.call(new _)))!==Object.prototype&&g.next&&(o(g,m,!0),e||"function"==typeof g[a]||i(g,a,y)),A&&O&&O.name!==q&&(F=!0,P=function(){return O.call(this)}),e&&!d||!c&&!F&&I[a]||i(I,a,P),n[p]=P,n[m]=y,v)if(x={values:A?P:j(q),keys:w?P:j(l),entries:z},d)for(b in x)b in I||t(I,b,x[b]);else r(r.P+r.F*(c||F),p,x);return x}; },{"./_library":"H21C","./_export":"izCb","./_redefine":"PHot","./_hide":"NXbe","./_iterators":"JO4d","./_iter-create":"ebgP","./_set-to-string-tag":"rq3q","./_object-gpo":"q6yw","./_wks":"AIP1"}],"wVEN":[function(require,module,exports) { "use strict";var e=require("./_add-to-unscopables"),r=require("./_iter-step"),t=require("./_iterators"),i=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=i(e),this._i=0,this._k=r},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])},"values"),t.Arguments=t.Array,e("keys"),e("values"),e("entries"); -},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RB6b":[function(require,module,exports) { +},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RBsu":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(1);r(r.P+r.F*!require("./_strict-method")([].map,!0),"Array",{map:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"RB6b":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_create-property");r(r.S+r.F*require("./_fails")(function(){function r(){}return!(Array.of.call(r)instanceof r)}),"Array",{of:function(){for(var r=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>r;)e(n,r,arguments[r++]);return n.length=t,n}}); -},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"Hh2M":[function(require,module,exports) { -"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; -},{"./_fails":"BXiR"}],"nrVf":[function(require,module,exports) { +},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"btFn":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_html"),i=require("./_cof"),t=require("./_to-absolute-index"),u=require("./_to-length"),a=[].slice;r(r.P+r.F*require("./_fails")(function(){e&&a.call(e)}),"Array",{slice:function(r,e){var l=u(this.length),n=i(this);if(e=void 0===e?l:e,"Array"==n)return a.call(this,r,e);for(var s=t(r,l),c=t(e,l),h=u(c-s),o=new Array(h),f=0;f=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)} -},{}],"RDO9":[function(require,module,exports) { +},{"./es6.array.iterator":"wVEN","./_object-keys":"U9a7","./_redefine":"PHot","./_global":"qf4T","./_hide":"NXbe","./_iterators":"JO4d","./_wks":"AIP1"}],"RDO9":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=function(){var t=0,l=document.createElement("div");function n(e){return l.appendChild(e.dom),e}function a(e){for(var n=0;no+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:l,setMode:a}};exports.default=e,e.Panel=function(e,t,l){var n=1/0,a=0,i=Math.round,o=i(window.devicePixelRatio||1),r=80*o,f=48*o,d=3*o,c=2*o,p=3*o,s=15*o,u=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=l,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,d,c),v.fillRect(p,s,u,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p,s,u,m),{dom:h,update:function(f,x){n=Math.min(n,f),a=Math.max(a,f),v.fillStyle=l,v.globalAlpha=1,v.fillRect(0,0,r,s),v.fillStyle=t,v.fillText(i(f)+" "+e+" ("+i(n)+"-"+i(a)+")",d,c),v.drawImage(h,p+o,s,u-o,m,p,s,u-o,m),v.fillRect(p+u-o,s,o,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p+u-o,s,o,i((1-f/x)*m))}}}; },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"dKqR":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArrayCamera=ch,exports.AxisHelper=lx,exports.BinaryTextureLoader=dx,exports.Bone=Yh,exports.BoundingBoxHelper=cx,exports.BufferAttribute=bi,exports.BufferGeometry=ki,exports.Camera=gs,exports.CanvasRenderer=fx,exports.CompressedTextureLoader=md,exports.CubicInterpolant=Xp,exports.Curve=yd,exports.DataTextureLoader=xd,exports.DiscreteInterpolant=Zp,exports.DynamicBufferAttribute=Kg,exports.EdgesHelper=hx,exports.EventDispatcher=In,exports.FileLoader=pd,exports.Float16BufferAttribute=Ri,exports.Float32Attribute=ox,exports.Float32BufferAttribute=Ci,exports.Float64Attribute=ax,exports.Float64BufferAttribute=Pi,exports.GLBufferAttribute=xf,exports.ImageBitmapLoader=Sm,exports.ImmediateRenderObject=Lf,exports.InstancedBufferAttribute=vm,exports.InstancedBufferGeometry=xm,exports.InstancedInterleavedBuffer=gf,exports.InstancedMesh=nu,exports.Int16Attribute=nx,exports.Int16BufferAttribute=Ti,exports.Int32Attribute=ix,exports.Int32BufferAttribute=Ai,exports.Int8Attribute=$g,exports.Int8BufferAttribute=wi,exports.InterleavedBuffer=_h,exports.InterleavedBufferAttribute=wh,exports.Interpolant=qp,exports.JSONLoader=gx,exports.LensFlare=vx,exports.Line=cu,exports.LineSegments=pu,exports.LinearInterpolant=Yp,exports.Loader=hd,exports.LoadingManager=ld,exports.Material=hi,exports.Mesh=os,exports.MeshFaceMaterial=Vg,exports.MeshPhysicalMaterial=Op,exports.MeshStandardMaterial=Fp,exports.MultiMaterial=Wg,exports.Object3D=Xr,exports.ParametricGeometry=exports.ParametricBufferGeometry=wp,exports.Particle=qg,exports.ParticleBasicMaterial=Zg,exports.ParticleSystem=Xg,exports.ParticleSystemMaterial=Jg,exports.PerspectiveCamera=xs,exports.PointCloud=jg,exports.PointCloudMaterial=Yg,exports.Points=yu,exports.PropertyBinding=uf,exports.QuaternionLinearInterpolant=td,exports.Raycaster=vf,exports.ShaderMaterial=fs,exports.SkinnedMesh=Xh,exports.TextureLoader=vd,exports.Uint16Attribute=rx,exports.Uint16BufferAttribute=Ei,exports.Uint32Attribute=sx,exports.Uint32BufferAttribute=Li,exports.Uint8Attribute=tx,exports.Uint8BufferAttribute=Mi,exports.Uint8ClampedAttribute=ex,exports.Uint8ClampedBufferAttribute=Si,exports.Vertex=Qg,exports.WebGLRenderTargetCube=mx,exports.WebGLRenderer=fh,exports.WebGLUtils=lh,exports.WireframeHelper=ux,exports.XHRLoader=px,exports.FloatType=exports.FlatShading=exports.FaceColors=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTexture=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CanvasTexture=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.ObjectLoader=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MaterialLoader=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.ImageLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.FontLoader=exports.Font=exports.FogExp2=exports.Fog=void 0,exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.Path=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VertexColors=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.Texture=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=void 0;const t="126";exports.REVISION="126";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const r=0;exports.CullFaceNone=r;const i=1;exports.CullFaceBack=i;const s=2;exports.CullFaceFront=s;const o=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const l=1;exports.PCFShadowMap=l;const c=2;exports.PCFSoftShadowMap=c;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const m=1;exports.FlatShading=1;const f=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const I=206;exports.DstAlphaFactor=I;const B=207;exports.OneMinusDstAlphaFactor=B;const N=208;exports.DstColorFactor=N;const F=209;exports.OneMinusDstColorFactor=F;const O=210;exports.SrcAlphaSaturateFactor=O;const z=0;exports.NeverDepth=z;const G=1;exports.AlwaysDepth=G;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=et;const nt=301;exports.CubeReflectionMapping=nt;const rt=302;exports.CubeRefractionMapping=rt;const it=303;exports.EquirectangularReflectionMapping=it;const st=304;exports.EquirectangularRefractionMapping=st;const ot=306;exports.CubeUVReflectionMapping=ot;const at=307;exports.CubeUVRefractionMapping=at;const lt=1e3;exports.RepeatWrapping=lt;const ct=1001;exports.ClampToEdgeWrapping=ct;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const mt=1005;exports.NearestMipmapLinearFilter=mt;const ft=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const It=1021;exports.AlphaFormat=It;const Bt=1022;exports.RGBFormat=Bt;const Nt=1023;exports.RGBAFormat=Nt;const Ft=1024;exports.LuminanceFormat=Ft;const Ot=1025;exports.LuminanceAlphaFormat=Ot;const zt=Nt;exports.RGBEFormat=zt;const Gt=1026;exports.DepthFormat=Gt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const re=37496;exports.RGBA_ETC2_EAC_Format=re;const ie=37808;exports.RGBA_ASTC_4x4_Format=ie;const se=37809;exports.RGBA_ASTC_5x4_Format=se;const oe=37810;exports.RGBA_ASTC_5x5_Format=oe;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const le=37812;exports.RGBA_ASTC_6x6_Format=le;const ce=37813;exports.RGBA_ASTC_8x5_Format=ce;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const me=37818;exports.RGBA_ASTC_10x8_Format=me;const fe=37819;exports.RGBA_ASTC_10x10_Format=fe;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Ie=2200;exports.LoopOnce=Ie;const Be=2201;exports.LoopRepeat=Be;const Ne=2202;exports.LoopPingPong=Ne;const Fe=2300;exports.InterpolateDiscrete=Fe;const Oe=2301;exports.InterpolateLinear=Oe;const ze=2302;exports.InterpolateSmooth=ze;const Ge=2400;exports.ZeroCurvatureEnding=Ge;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const sn=1;exports.ObjectSpaceNormalMap=sn;const on=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const ln=7681;exports.ReplaceStencilOp=7681;const cn=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const mn=512;exports.NeverStencilFunc=512;const fn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function In(){}exports.GLSL3=Dn,Object.assign(In.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e>8&255]+Bn[t>>16&255]+Bn[t>>24&255]+"-"+Bn[255&e]+Bn[e>>8&255]+"-"+Bn[e>>16&15|64]+Bn[e>>24&255]+"-"+Bn[63&n|128]+Bn[n>>8&255]+"-"+Bn[n>>16&255]+Bn[n>>24&255]+Bn[255&r]+Bn[r>>8&255]+Bn[r>>16&255]+Bn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Fn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Fn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Nn=t%2147483647),((Nn=16807*Nn%2147483647)-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),h=o((e+r)/2),u=s((e-r)/2),p=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(i){case"XYX":t.set(a*h,l*u,l*p,a*c);break;case"YZY":t.set(l*p,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*p,a*h,a*c);break;case"XZX":t.set(a*h,l*m,l*d,a*c);break;case"YXY":t.set(l*d,a*h,l*m,a*c);break;case"ZYZ":t.set(l*m,l*d,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};exports.MathUtils=exports.Math=Fn;class On{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=On,On.prototype.isVector2=!0;class zn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],m=r[0],f=r[3],g=r[6],x=r[1],v=r[4],y=r[7],_=r[2],b=r[5],w=r[8];return i[0]=s*m+o*x+a*_,i[3]=s*f+o*v+a*b,i[6]=s*g+o*y+a*w,i[1]=l*m+c*x+h*_,i[4]=l*f+c*v+h*b,i[7]=l*g+c*y+h*w,i[2]=u*m+p*x+d*_,i[5]=u*f+p*v+d*b,i[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*i*c+n*o*a+r*i*l-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*i,p=l*i-s*a,d=e*h+n*u+r*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=h*m,t[1]=(r*l-c*n)*m,t[2]=(o*n-r*s)*m,t[3]=u*m,t[4]=(c*e-r*a)*m,t[5]=(r*i-o*e)*m,t[6]=p*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*i)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,s,o){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-r*l,r*a,-r*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],l=r[4],c=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*a,r[4]=-n*s+e*l,r[7]=-n*o+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;exports.Matrix3=zn,zn.prototype.isMatrix3=!0;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;class kn extends In{constructor(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=ct,r=ct,i=gt,s=yt,o=Nt,a=bt,l=1,c=Xe){super(),Object.defineProperty(this,"id",{value:Un++}),this.uuid=Fn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new On(0,0),this.repeat=new On(1,1),this.center=new On(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=Fn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t1)switch(this.wrapS){case lt:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case lt:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}exports.Texture=kn,kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=et,kn.prototype.isTexture=!0;class Wn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const s=t.elements,o=s[0],a=s[4],l=s[8],c=s[1],h=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(h+1)/2,f=(m+1)/2,g=(a+c)/4,x=(l+p)/4,v=(u+d)/4;return t>s&&t>f?t<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(t)),i=x/n):s>f?s<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(s)),i=v/r):f<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(f)),r=v/i),this.set(n,r,i,e),this}let f=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-a)*(c-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(l-p)/f,this.z=(c-a)/f,this.w=Math.acos((o+h+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn,Wn.prototype.isVector4=!0;class jn extends In{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn,jn.prototype.isWebGLRenderTarget=!0;class qn extends jn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn,qn.prototype.isWebGLMultisampleRenderTarget=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[s+0],p=i[s+1],d=i[s+2],m=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(h!==m||a!==u||l!==p||c!==d){let t=1-o;const e=a*u+l*p+c*d+h*m,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+u*i,l=l*t+p*i,c=c*t+d*i,h=h*t+m*i,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[s],u=i[s+1],p=i[s+2],d=i[s+3];return t[e]=o*d+c*h+a*p-l*u,t[e+1]=a*d+c*u+l*h-o*p,t[e+2]=l*d+c*p+o*u-a*h,t[e+3]=c*d-o*h-a*u-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=a(n/2),p=a(r/2),d=a(i/2);switch(s){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(i-l)*t,this._z=(s-r)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(i-l)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-r)/t,this._x=(i+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+r*l-i*a,this._y=r*c+s*a+i*o-n*l,this._z=i*c+s*l+n*a-r*o,this._w=s*c-n*o-r*a-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn,Xn.prototype.isQuaternion=!0;class Yn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*r-o*n,c=a*n+o*e-i*r,h=a*r+i*n-s*e,u=-i*e-s*n-o*r;return this.x=l*a+u*-i+c*-o-h*-s,this.y=c*a+u*-s+h*-i-l*-o,this.z=h*a+u*-o+l*-s-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn,Yn.prototype.isVector3=!0;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t=new Yn(1/0,1/0,1/0),e=new Yn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$n),$n.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ar),lr.subVectors(this.max,ar),er.subVectors(t.a,ar),nr.subVectors(t.b,ar),rr.subVectors(t.c,ar),ir.subVectors(nr,er),sr.subVectors(rr,nr),or.subVectors(er,rr);let e=[0,-ir.z,ir.y,0,-sr.z,sr.y,0,-or.z,or.y,ir.z,0,-ir.x,sr.z,0,-sr.x,or.z,0,-or.x,-ir.y,ir.x,0,-sr.y,sr.x,0,-or.y,or.x,0];return!!ur(e,er,nr,rr,lr)&&(!!ur(e=[1,0,0,0,1,0,0,0,1],er,nr,rr,lr)&&(cr.crossVectors(ir,sr),ur(e=[cr.x,cr.y,cr.z],er,nr,rr,lr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $n.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize($n).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box3=Qn,Qn.prototype.isBox3=!0;const Kn=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],$n=new Yn,tr=new Qn,er=new Yn,nr=new Yn,rr=new Yn,ir=new Yn,sr=new Yn,or=new Yn,ar=new Yn,lr=new Yn,cr=new Yn,hr=new Yn;function ur(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){hr.fromArray(t,s);const o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),a=e.dot(hr),l=n.dot(hr),c=r.dot(hr);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const pr=new Qn;class dr{constructor(t=new Yn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}exports.Sphere=dr;const mr=new Yn,fr=new Yn,gr=new Yn,xr=new Yn,vr=new Yn,yr=new Yn,_r=new Yn;class br{constructor(t=new Yn,e=new Yn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mr.copy(this.direction).multiplyScalar(e).add(this.origin),mr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){fr.copy(t).add(e).multiplyScalar(.5),gr.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(fr);const i=.5*t.distanceTo(e),s=-this.direction.dot(gr),o=xr.dot(this.direction),a=-xr.dot(gr),l=xr.lengthSq(),c=Math.abs(1-s*s);let h,u,p,d;if(c>0)if(u=s*o-a,d=i*c,(h=s*a-o)>=0)if(u>=-d)if(u<=d){const t=1/c;p=(h*=t)*(h+s*(u*=t)+2*o)+u*(s*h+u+2*a)+l}else u=i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u=-i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u<=-d?p=-(h=Math.max(0,-(-s*i+o)))*h+(u=h>0?-i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l:u<=d?(h=0,p=(u=Math.min(Math.max(-i,-a),i))*(u+2*a)+l):p=-(h=Math.max(0,-(s*i+o)))*h+(u=h>0?i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l;else u=s>0?-i:i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(gr).multiplyScalar(u).add(fr),p}intersectSphere(t,e){mr.subVectors(t.center,this.origin);const n=mr.dot(this.direction),r=mr.dot(mr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,r=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,r=(t.min.x-u.x)*l),c>=0?(i=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(i=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||i>r?null:((i>n||n!=n)&&(n=i),(s=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>r?null:((o>n||n!=n)&&(n=o),(a=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mr)}intersectTriangle(t,e,n,r,i){vr.subVectors(e,t),yr.subVectors(n,t),_r.crossVectors(vr,yr);let s,o=this.direction.dot(_r);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}xr.subVectors(this.origin,t);const a=s*this.direction.dot(yr.crossVectors(xr,yr));if(a<0)return null;const l=s*this.direction.dot(vr.cross(xr));if(l<0)return null;if(a+l>o)return null;const c=-s*xr.dot(_r);return c<0?null:this.at(c/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}exports.Ray=br;class wr{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l,c,h,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wr).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Mr.setFromMatrixColumn(t,0).length(),i=1/Mr.setFromMatrixColumn(t,1).length(),s=1/Mr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-o*a,e[2]=i-t*l,e[6]=r+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t-i*o,e[4]=-s*h,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*c,e[9]=i-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=a*h,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=i-t*h,e[8]=r*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+r,e[10]=t-i*h}else if("XZY"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+i,e[5]=s*c,e[9]=n*h-r,e[2]=r*h-n,e[6]=o*c,e[10]=i*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tr,t,Er)}lookAt(t,e,n){const r=this.elements;return Rr.subVectors(t,e),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ar.crossVectors(n,Rr),0===Ar.lengthSq()&&(1===Math.abs(n.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ar.crossVectors(n,Rr)),Ar.normalize(),Lr.crossVectors(Rr,Ar),r[0]=Ar.x,r[4]=Lr.x,r[8]=Rr.x,r[1]=Ar.y,r[5]=Lr.y,r[9]=Rr.y,r[2]=Ar.z,r[6]=Lr.z,r[10]=Rr.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],m=n[6],f=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],B=r[7],N=r[11],F=r[15];return i[0]=s*b+o*T+a*R+l*I,i[4]=s*w+o*E+a*C+l*B,i[8]=s*M+o*A+a*P+l*N,i[12]=s*S+o*L+a*D+l*F,i[1]=c*b+h*T+u*R+p*I,i[5]=c*w+h*E+u*C+p*B,i[9]=c*M+h*A+u*P+p*N,i[13]=c*S+h*L+u*D+p*F,i[2]=d*b+m*T+f*R+g*I,i[6]=d*w+m*E+f*C+g*B,i[10]=d*M+m*A+f*P+g*N,i[14]=d*S+m*L+f*D+g*F,i[3]=x*b+v*T+y*R+_*I,i[7]=x*w+v*E+y*C+_*B,i[11]=x*M+v*A+y*P+_*N,i[15]=x*S+v*L+y*D+_*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+i*a*h-r*l*h-i*o*u+n*l*u+r*o*p-n*a*p)+t[7]*(+e*a*p-e*l*u+i*s*u-r*s*p+r*l*c-i*a*c)+t[11]*(+e*l*h-e*o*p-i*s*h+n*s*p+i*o*c-n*l*c)+t[15]*(-r*o*c-e*a*h+e*o*u+r*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],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]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,l=i*s,c=i*o;return this.set(l*s+n,l*o-r*a,l*a+r*o,0,l*o+r*a,c*o+n,c*a-r*s,0,l*a-r*o,c*a+r*s,i*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,l=i+i,c=s+s,h=o+o,u=i*l,p=i*c,d=i*h,m=s*c,f=s*h,g=o*h,x=a*l,v=a*c,y=a*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(m+g))*_,r[1]=(p+y)*_,r[2]=(d-v)*_,r[3]=0,r[4]=(p-y)*b,r[5]=(1-(u+g))*b,r[6]=(f+x)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(f-x)*w,r[10]=(1-(u+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Mr.set(r[0],r[1],r[2]).length();const s=Mr.set(r[4],r[5],r[6]).length(),o=Mr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Sr.copy(this);const a=1/i,l=1/s,c=1/o;return Sr.elements[0]*=a,Sr.elements[1]*=a,Sr.elements[2]*=a,Sr.elements[4]*=l,Sr.elements[5]*=l,Sr.elements[6]*=l,Sr.elements[8]*=c,Sr.elements[9]*=c,Sr.elements[10]*=c,e.setFromRotationMatrix(Sr),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),h=(n+r)/(n-r),u=-(s+i)/(s-i),p=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),l=1/(n-r),c=1/(s-i),h=(e+t)*a,u=(n+r)*l,p=(s+i)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wr,wr.prototype.isMatrix4=!0;const Mr=new Yn,Sr=new wr,Tr=new Yn(0,0,0),Er=new Yn(1,1,1),Ar=new Yn,Lr=new Yn,Rr=new Yn,Cr=new wr,Pr=new Xn;class Dr{constructor(t=0,e=0,n=0,r=Dr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Fn.clamp,i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Pr.setFromEuler(this),this.setFromQuaternion(Pr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Dr,Dr.prototype.isEuler=!0,Dr.DefaultOrder="XYZ",Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ir{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){r.children=[];for(let e=0;e0){r.animations=[];for(let e=0;e0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function s(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n1?void 0:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Jr.getNormalMatrix(t),r=this.coplanarPoint(Yr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}exports.Plane=Qr,Qr.prototype.isPlane=!0;const Kr=new Yn,$r=new Yn,ti=new Yn,ei=new Yn,ni=new Yn,ri=new Yn,ii=new Yn,si=new Yn,oi=new Yn,ai=new Yn;class li{constructor(t=new Yn,e=new Yn,n=new Yn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Yn),r.subVectors(n,e),Kr.subVectors(t,e),r.cross(Kr);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Kr.subVectors(r,e),$r.subVectors(n,e),ti.subVectors(t,e);const s=Kr.dot(Kr),o=Kr.dot($r),a=Kr.dot(ti),l=$r.dot($r),c=$r.dot(ti),h=s*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Yn),0===h)return i.set(-2,-1,-1);const u=1/h,p=(l*a-o*c)*u,d=(s*c-o*a)*u;return i.set(1-p-d,d,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ei),a.set(0,0),a.addScaledVector(i,ei.x),a.addScaledVector(s,ei.y),a.addScaledVector(o,ei.z),a}static isFrontFacing(t,e,n,r){return Kr.subVectors(n,e),$r.subVectors(t,e),Kr.cross($r).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Kr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Kr.cross($r).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return li.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qr),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return li.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return li.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return li.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return li.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,r=this.b,i=this.c;let s,o;ni.subVectors(r,n),ri.subVectors(i,n),si.subVectors(t,n);const a=ni.dot(si),l=ri.dot(si);if(a<=0&&l<=0)return e.copy(n);oi.subVectors(t,r);const c=ni.dot(oi),h=ri.dot(oi);if(c>=0&&h<=c)return e.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(ni,s);ai.subVectors(t,i);const p=ni.dot(ai),d=ri.dot(ai);if(d>=0&&p<=d)return e.copy(i);const m=p*l-a*d;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),e.copy(n).addScaledVector(ri,o);const f=c*d-p*h;if(f<=0&&h-c>=0&&p-d>=0)return ii.subVectors(i,r),o=(h-c)/(h-c+(p-d)),e.copy(r).addScaledVector(ii,o);const g=1/(f+m+u);return s=m*g,o=u*g,e.copy(n).addScaledVector(ni,s).addScaledVector(ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=li;let ci=0;function hi(){Object.defineProperty(this,"id",{value:ci++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}hi.prototype=Object.assign(Object.create(In.prototype),{constructor:hi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(hi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},di={h:0,s:0,l:0};function mi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function fi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=mi(i,r,t+1/3),this.g=mi(i,r,t),this.b=mi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ui[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}copyLinearToSRGB(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const l=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=l<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(ne&&(e=t[n]);return e}Object.defineProperty(bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r65535?Li:Ei)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new zn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fi.makeRotationX(t),this.applyMatrix4(Fi),this},rotateY:function(t){return Fi.makeRotationY(t),this.applyMatrix4(Fi),this},rotateZ:function(t){return Fi.makeRotationZ(t),this.applyMatrix4(Fi),this},translate:function(t,e,n){return Fi.makeTranslation(t,e,n),this.applyMatrix4(Fi),this},scale:function(t,e,n){return Fi.makeScale(t,e,n),this.applyMatrix4(Fi),this},lookAt:function(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],r=e.toJSON(t.data);""!==e.name&&(r.name=e.name),t.data.attributes[a]=r}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ki).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const l in r){const t=r[l];this.setAttribute(l,t.clone(e))}const i=t.morphAttributes;for(const l in i){const t=[],n=i[l];for(let r=0,i=n.length;rn.far?null:{distance:c,point:ss.clone(),object:t}}function ls(t,e,n,r,i,s,o,a,l,c,h,u){qi.fromBufferAttribute(i,c),Xi.fromBufferAttribute(i,h),Yi.fromBufferAttribute(i,u);const p=t.morphTargetInfluences;if(e.morphTargets&&s&&p){Ki.set(0,0,0),$i.set(0,0,0),ts.set(0,0,0);for(let t=0,e=s.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(i),!1===t.ray.intersectsSphere(ji))return;if(Vi.copy(i).invert(),Wi.copy(t.ray).applyMatrix4(Vi),null!==n.boundingBox&&!1===Wi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;n0?1:-1,c.push(A.x,A.y,A.z),h.push(a/f),h.push(1-o/g),T+=1}}for(let o=0;o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},gs.prototype=Object.assign(Object.create(Xr.prototype),{constructor:gs,isCamera:!0,copy:function(t,e){return Xr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),xs.prototype=Object.assign(Object.create(gs.prototype),{constructor:xs,isPerspectiveCamera:!0,copy:function(t,e){return gs.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xr.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const vs=90,ys=1;class _s extends Xr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new xs(vs,ys,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(1,0,0)),this.add(r);const i=new xs(vs,ys,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(-1,0,0)),this.add(i);const s=new xs(vs,ys,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Yn(0,1,0)),this.add(s);const o=new xs(vs,ys,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Yn(0,-1,0)),this.add(o);const a=new xs(vs,ys,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const l=new xs(vs,ys,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Yn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}exports.CubeCamera=_s;class bs extends kn{constructor(t,e,n,r,i,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:nt,n,r,i,s,o=void 0!==o?o:Bt,a,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}exports.CubeTexture=bs,bs.prototype.isCubeTexture=!0;class ws extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bs(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:gt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Nt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new cs(5,5,5),i=new fs({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});i.uniforms.tEquirect.value=e;const s=new os(r,i),o=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new _s(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}exports.WebGLCubeRenderTarget=ws,ws.prototype.isWebGLCubeRenderTarget=!0;class Ms extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ut,this.minFilter=void 0!==c?c:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}exports.DataTexture=Ms,Ms.prototype.isDataTexture=!0;const Ss=new dr,Ts=new Yn;class Es{constructor(t=new Qr,e=new Qr,n=new Qr,r=new Qr,i=new Qr,s=new Qr){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],m=n[11],f=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(o-r,h-a,m-u,v-f).normalize(),e[1].setComponents(o+r,h+a,m+u,v+f).normalize(),e[2].setComponents(o+i,h+l,m+p,v+g).normalize(),e[3].setComponents(o-i,h-l,m-p,v-g).normalize(),e[4].setComponents(o-s,h-c,m-d,v-x).normalize(),e[5].setComponents(o+s,h+c,m+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version=0){const s=l[e];if(void 0!==s){const e=s.normalized,i=s.itemSize,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(f(r,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r+0,1),f(r+1,1),f(r+2,1),f(r+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r+0,4,o,!1,64,0),t.vertexAttribPointer(r+1,4,o,!1,64,16),t.vertexAttribPointer(r+2,4,o,!1,64,32),t.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)u(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function rl(t,e,n,r){const i=r.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,r){t.drawArrays(s,e,r),n.update(r,s,1)},this.renderInstances=function(r,o,a){if(0===a)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,r,o,a),n.update(o,s,a)}}function il(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=s||e.has("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:s?t.getParameter(36183):0}}function sl(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Qr,a=new zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==i||null===c){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length0){const o=t.getRenderTarget(),a=new ws(s.height/2);return a.fromEquirectangularTexture(t,i),e.set(i,a),t.setRenderTarget(o),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function al(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ll(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e65535?Li:Ei)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===i[e.id]?e:(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n0)return t;const i=e*n;let s=bl[i];if(void 0===s&&(s=new Float32Array(i),bl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function Al(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n/gm;function Rc(t){return t.replace(Lc,Cc)}function Cc(t,e){const n=Ka[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Pc=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Dc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ic(t){return t.replace(Dc,Nc).replace(Pc,Bc)}function Bc(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nc(t,e,n,r)}function Nc(t,e,n,r){let i="";for(let s=parseInt(e);s0?t.gammaFactor:1,d=n.isWebGL2?"":wc(n),m=Mc(s),f=i.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[m].filter(Tc).join("\n")).length>0&&(g+="\n"),(x=[d,m].filter(Tc).join("\n")).length>0&&(x+="\n")):(g=[Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Tc).join("\n"),x=[d,Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?Ka.tonemapping_pars_fragment:"",n.toneMapping!==Z?bc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ka.encodings_pars_fragment,n.map?yc("mapTexelToLinear",n.mapEncoding):"",n.matcap?yc("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?yc("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?yc("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?yc("lightMapTexelToLinear",n.lightMapEncoding):"",_c("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Tc).join("\n")),o=Ac(o=Ec(o=Rc(o),n),n),a=Ac(a=Ec(a=Rc(a),n),n),o=Ic(o),a=Ic(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const y=v+x+a,_=mc(i,35633,v+g+o),b=mc(i,35632,y);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(f).trim(),e=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const e=vc(i,_,"vertex"),n=vc(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new dc(i,f)),w},this.getAttributes=function(){return void 0===M&&(M=Sc(i,f)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=fc++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}function kc(t,e,n,r,i,s){const o=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let m=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(i,o,g,v,y){const _=v.fog,b=i.isMeshStandardMaterial?v.environment:null,w=e.get(i.envMap||b),M=f[i.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===d,flipSided:i.side===p,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&r.sort(t||Wc),i.length>1&&i.sort(e||jc)}}}function Xc(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new qc(t),e.set(n,[i])):r>=e.get(n).length?(i=new qc(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new xi};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Zc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Jc=0;function Qc(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Kc(t,e){const n=new Yc,r=Zc(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)i.probe.push(new Yn);const s=new Yn,o=new wr,a=new wr;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,h=0,u=0,p=0,d=0,m=0,f=0,g=0;s.sort(Qc);for(let t=0,e=s.length;t0&&(e.isWebGL2?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=$a.LTC_HALF_1,i.rectAreaLTC2=$a.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=a,i.ambient[2]=l;const x=i.hash;x.directionalLength===c&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===m&&x.numPointShadows===f&&x.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=p,i.point.length=h,i.hemi.length=d,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=f,i.spotShadowMatrix.length=g,x.directionalLength=c,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=m,x.numPointShadows=f,x.numSpotShadows=g,i.version=Jc++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p=n.get(r).length?(s=new $c(t,e),n.get(r).push(s)):s=n.get(r)[i],s},dispose:function(){n=new WeakMap}}}class eh extends hi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}exports.MeshDepthMaterial=eh,eh.prototype.isMeshDepthMaterial=!0;class nh extends hi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}exports.MeshDistanceMaterial=nh,nh.prototype.isMeshDistanceMaterial=!0;var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ih="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let r=new Es;const i=new On,s=new On,o=new Wn,a=[],c=[],m={},f={0:p,1:u,2:d},x=new fs({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new On},radius:{value:4}},vertexShader:ih,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new ki;y.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new os(y,x),b=this;function w(n,r){const i=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,_,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=a[r];return void 0===i&&(i=new eh({depthPacking:nn,morphTargets:t,skinning:e}),a[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=c[r];return void 0===i&&(i=new nh({morphTargets:t,skinning:e}),c[r]=i),i}function T(e,n,r,i,s,o,a){let l=null,c=M,u=e.customDepthMaterial;if(!0===i.isPointLight&&(c=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(t,i,!0===e.isInstancedMesh)}else l=u;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=a===h?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=s,l.farDistance=o),l}function E(n,i,s,o,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;ln||i.y>n)&&(i.x>n&&(s.x=Math.floor(n/p.x),i.x=s.x*p.x,u.mapSize.x=s.x),i.y>n&&(s.y=Math.floor(n/p.y),i.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new jn(i.x,i.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(ot=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),st=ot>=2);let lt=null,ct={};const ht=new Wn,ut=new Wn;function pt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;or||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Fn.floorPowerOfTwo:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===d&&(d=f(s,o));const a=n?f(s,o):d;return a.width=s,a.height=o,a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,i,s){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,s))}function _(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function b(t){return t===ut||t===pt||t===mt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),s=r.get(n);if(!e)return;void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function E(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;C(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=o||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const u=h[0],p=x(u)||a,d=s.convert(r.format),m=s.convert(r.type),f=_(r.internalFormat,d,m);let b;if(R(34067,r,p),o){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),o.memory.textures++)}function P(e,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==ut&&t.minFilter!==gt)}(r)&&!1===x(r.image),c=g(r.image,l,!1,h),u=x(c)||a,p=s.convert(r.format);let d,m=s.convert(r.type),f=_(r.internalFormat,p,m);R(o,r,u);const b=r.mipmaps;if(r.isDepthTexture)f=6402,a?f=r.type===At?36012:r.type===Et?33190:r.type===Dt?35056:33189:r.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===f&&r.type!==St&&r.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=St,m=s.convert(r.type)),r.format===Ht&&6402===f&&(f=34041,r.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Dt,m=s.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t0&&u){for(let t=0,e=b.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,p=i.isDataTexture3D||i.isDataTexture2DArray,d=x(e)||a;if(!a||i.format!==Bt||i.type!==At&&i.type!==Lt||(i.format=Nt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(i.format),r=s.convert(i.type),o=_(i.internalFormat,n,r),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),I(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),R(34067,i,d);for(let t=0;t<6;t++)D(l.__webglFramebuffer[t],e,36064,34069+t);v(i,d)&&y(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;p&&(a?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),R(t,i,d),D(l.__webglFramebuffer,e,36064,t),v(i,d)&&y(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const i=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;n.bindTexture(i,s),y(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===It)return 6406;if(t===Bt)return 6407;if(t===Nt)return 6408;if(t===Ft)return 6409;if(t===Ot)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===re)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===re)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ie||t===se||t===oe||t===ae||t===le||t===ce||t===he||t===ue||t===pe||t===de||t===me||t===fe||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(t=[]){xs.call(this),this.cameras=t}ch.prototype=Object.assign(Object.create(xs.prototype),{constructor:ch,isArrayCamera:!0});class hh extends Xr{constructor(){super(),this.type="Group"}}function uh(){this._targetRay=null,this._grip=null,this._hand=null}function ph(t,e){const n=this;let r=null,i=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new xs;h.layers.enable(1),h.viewport=new Wn;const u=new xs;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new ch;d.layers.enable(1),d.layers.enable(2);let m=null,f=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){c.forEach(function(t,e){t.disconnect(e)}),c.clear(),m=null,f=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=r.inputSources;for(let n=0;n0&&wt(s,t,e),o.length>0&&wt(o,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==_&&(X.updateRenderTargetMipmap(_),X.updateMultisampleRenderTarget(_)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,d.pop(),u=d.length>0?d[d.length-1]:null},this.setFramebuffer=function(t){x!==t&&null===_&&ht.bindFramebuffer(36160,t),x=t},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=x,i=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=o[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),E=t.scissorTest}else S.copy(D).multiplyScalar(R).floor(),T.copy(I).multiplyScalar(R).floor(),E=B;if(b!==r&&(ht.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(T),W.setScissorTest(E),i){const r=q.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(s){const r=q.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==b&&(ht.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Nt&<.convert(l)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===Lt&&(k.has("EXT_color_buffer_half_float")||V.isWebGL2&&k.has("EXT_color_buffer_float"));if(!(c===bt||lt.convert(c)===ht.getParameter(35738)||c===At&&(V.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ht.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),o=lt.convert(e.format);X.setTexture2D(e,0),ht.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=lt.convert(n.format),a=lt.convert(n.type);X.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let h;if(r.isDataTexture3D)X.setTexture3D(r,0),h=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),h=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const u=ht.getParameter(3314),p=ht.getParameter(32878),d=ht.getParameter(3316),m=ht.getParameter(3315),g=ht.getParameter(32877);ht.pixelStorei(3314,s),ht.pixelStorei(32878,o),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),ht.texSubImage3D(h,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,a),ht.pixelStorei(3314,u),ht.pixelStorei(32878,p),ht.pixelStorei(3316,d),ht.pixelStorei(3315,m),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(h),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}exports.Group=hh,hh.prototype.isGroup=!0,Object.assign(uh.prototype,{constructor:uh,getHandSpace:function(){return null===this._hand&&(this._hand=new hh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new hh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new hh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new hh;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const r=l.joints[s.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),this}}),Object.assign(ph.prototype,In.prototype);class gh extends fh{}exports.WebGL1Renderer=gh,gh.prototype.isWebGL1Renderer=!0;class xh{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new xh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=xh,xh.prototype.isFogExp2=!0;class vh{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new vh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=vh,vh.prototype.isFog=!0;class yh extends Xr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function _h(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}exports.Scene=yh,yh.prototype.isScene=!0,Object.defineProperty(_h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_h.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;rt.far||e.push({distance:a,point:Th.clone(),uv:li.getUV(Th,Ph,Dh,Ih,Bh,Nh,Fh,new On),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function zh(t,e,n,r,i,s){Lh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Rh.x=s*Lh.x-i*Lh.y,Rh.y=i*Lh.x+s*Lh.y):Rh.copy(Lh),t.copy(e),t.x+=Rh.x,t.y+=Rh.y,t.applyMatrix4(Ch)}exports.Sprite=Oh,Oh.prototype.isSprite=!0;const Gh=new Yn,Hh=new Yn;class Uh extends Xr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n0){let n,r;for(n=1,r=e.length;n0){Gh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Gh);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Gh.setFromMatrixPosition(t.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=Gh.distanceTo(Hh)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;ro)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);pt.far||e.push({distance:p,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,s=i.count-1;no)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const hu=new Yn,uu=new Yn;function pu(t,e){cu.call(this,t,e),this.type="LineSegments"}pu.prototype=Object.assign(Object.create(cu.prototype),{constructor:pu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;ti.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}yu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:yu,isPoints:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xu.copy(n.boundingSphere),xu.applyMatrix4(r),xu.radius+=i,!1===t.ray.intersectsSphere(xu))return;fu.copy(r).invert(),gu.copy(t.ray).applyMatrix4(fu);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class bu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.format=void 0!==o?o:Bt,this.minFilter=void 0!==s?s:gt,this.magFilter=void 0!==i?i:gt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}exports.VideoTexture=bu,bu.prototype.isVideoTexture=!0;class wu extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}exports.CompressedTexture=wu,wu.prototype.isCompressedTexture=!0;class Mu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.needsUpdate=!0}}exports.CanvasTexture=Mu,Mu.prototype.isCanvasTexture=!0;class Su extends kn{constructor(t,e,n,r,i,s,o,a,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=St),void 0===n&&c===Ht&&(n=Dt),super(null,r,i,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}}exports.DepthTexture=Su,Su.prototype.isDepthTexture=!0;class Tu extends ki{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],l=new Yn,c=new On;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const i=n+h/e*r;l.x=t*Math.cos(i),l.y=t*Math.sin(i),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[u]/t+1)/2,c.y=(s[u+1]/t+1)/2,a.push(c.x,c.y)}for(let h=1;h<=e;h++)i.push(h,h+1,0);this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("normal",new Ci(o,3)),this.setAttribute("uv",new Ci(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Tu;class Eu extends ki{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],h=[],u=[],p=[];let d=0;const m=[],f=n/2;let g=0;function x(n){const i=d,s=new On,m=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=r;t++)h.push(0,f*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=r;t++){const e=t/r*a+o,n=Math.cos(e),i=Math.sin(e);m.x=v*i,m.y=f*y,m.z=v*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*i*y+.5,p.push(s.x,s.y),d++}for(let t=0;t0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Eu;class Au extends Eu{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}}exports.ConeGeometry=exports.ConeBufferGeometry=Au;class Lu extends ki{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),l=i-o;for(let t=0;t<=l;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/l)}for(let o=0;o.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(i.slice(),3)),this.setAttribute("uv",new Ci(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Lu;class Ru extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Ru;const Cu=new Yn,Pu=new Yn,Du=new Yn,Iu=new li;class Bu extends ki{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Fn.DEG2RAD*e),i=t.getIndex(),s=t.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let p=0;p80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),p>h&&(h=p);d=0!==(d=Math.max(c-a,h-l))?1/d:0}return zu(s,o,n,a,l,d),o}};function Fu(t,e,n,r,i){let s,o;if(i===pp(t,e,n,r)>0)for(s=e;s=e;s-=r)o=cp(s,t[s],t[s+1],o);return o&&ep(o,o.next)&&(hp(o),o=o.next),o}function Ou(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!ep(r,r.next)&&0!==tp(r.prev,r,r.next))r=r.next;else{if(hp(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zu(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yu(t,r,i,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hu(t,r,i,s):Gu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),hp(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?zu(t=Uu(Ou(t),e,n),e,n,r,i,s,2):2===o&&ku(t,e,n,r,i,s):zu(Ou(t),e,n,r,i,s,1);break}}function Gu(t){const e=t.prev,n=t,r=t.next;if(tp(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ku(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&tp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Hu(t,e,n,r){const i=t.prev,s=t,o=t.next;if(tp(i,s,o)>=0)return!1;const a=i.xs.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,h=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=Ju(a,l,e,n,r),p=Ju(c,h,e,n,r);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Uu(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!ep(i,s)&&np(i,r,r.next,s)&&op(i,s)&&op(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),hp(r),hp(r.next),r=t=s),r=r.next}while(r!==t);return Ou(r)}function ku(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&$u(o,t)){let a=lp(o,t);return o=Ou(o,o.next),a=Ou(a,a.next),zu(o,e,n,r,i,s),void zu(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function Vu(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&r!==n.x&&Ku(is.x||n.x===s.x&&Xu(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}function Xu(t,e){return tp(t.prev,t,e.prev)<0&&tp(e.next,t,t.next)<0}function Yu(t,e,n,r){let i=t;do{null===i.z&&(i.z=Ju(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zu(i)}function Zu(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function Ju(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Qu(t){let e=t,n=t;do{(e.x=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function $u(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(op(t,e)&&op(e,t)&&ap(t,e)&&(tp(t.prev,t,e.prev)||tp(t,e.prev,e))||ep(t,e)&&tp(t.prev,t,t.next)>0&&tp(e.prev,e,e.next)>0)}function tp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ep(t,e){return t.x===e.x&&t.y===e.y}function np(t,e,n,r){const i=ip(tp(t,e,n)),s=ip(tp(t,e,r)),o=ip(tp(n,r,t)),a=ip(tp(n,r,e));return i!==s&&o!==a||(!(0!==i||!rp(t,n,e))||(!(0!==s||!rp(t,r,e))||(!(0!==o||!rp(n,t,r))||!(0!==a||!rp(n,e,r)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ip(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&np(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function op(t,e){return tp(t.prev,t,t.next)<0?tp(t,e,t.next)>=0&&tp(t,t.prev,e)>=0:tp(t,e,t.prev)<0||tp(t,t.next,e)<0}function ap(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function lp(t,e){const n=new up(t.i,t.x,t.y),r=new up(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cp(t,e,n,r){const i=new up(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function hp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function up(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pp(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function fp(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(l*l+c*c),d=e.x-a/u,m=e.y+o/u,f=((n.x-c/p-d)*c-(n.y+l/p-m)*l)/(o*c-a*l),g=(r=d+o*f-t.x)*r+(i=m+a*f-t.y)*i;if(g<=2)return new On(r,i);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(h)):(r=o,i=a,s=Math.sqrt(h/2))}return new On(r/s,i/s)}const P=[];for(let e=0,n=E.length,r=n-1,i=e+1;e=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*d;t=0?(t(p-1e-5,r,c),h.subVectors(l,c)):(t(p+1e-5,r,c),h.subVectors(c,l)),r-1e-5>=0?(t(p,r-1e-5,c),u.subVectors(l,c)):(t(p,r+1e-5,c),u.subVectors(c,l)),a.crossVectors(h,u).normalize(),s.push(a.x,a.y,a.z),o.push(p,r)}}for(let d=0;d0)&&p.push(e,r,o),(g!==n-1||a=r)){a.push(t.times[s]);for(let n=0;ns.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=e.times[u]){const t=u*l+a,n=t+l-a;p=jp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=l-a;t.evaluate(s),p=jp.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=i.times.length;for(let t=0;t=i)break t;{const o=e[1];t=(i=e[--n-1]))break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==i||s!==r){i>=s&&(i=(s=Math.max(s,1))-1);const t=this.getValueSize();this.times=jp.arraySlice(n,i,s),this.values=jp.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&jp.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=jp.arraySlice(this.times),e=jp.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===ze,i=t.length-1;let s=1;for(let o=1;o0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=jp.arraySlice(t,0,s),this.values=jp.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=jp.arraySlice(this.times,0),e=jp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}exports.KeyframeTrack=Jp,Jp.prototype.TimeBufferType=Float32Array,Jp.prototype.ValueBufferType=Float32Array,Jp.prototype.DefaultInterpolation=Oe;class Qp extends Jp{}exports.BooleanKeyframeTrack=Qp,Qp.prototype.ValueTypeName="bool",Qp.prototype.ValueBufferType=Array,Qp.prototype.DefaultInterpolation=Fe,Qp.prototype.InterpolantFactoryMethodLinear=void 0,Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends Jp{}exports.ColorKeyframeTrack=Kp,Kp.prototype.ValueTypeName="color";class $p extends Jp{}function td(t,e,n,r){qp.call(this,t,e,n,r)}exports.NumberKeyframeTrack=$p,$p.prototype.ValueTypeName="number",td.prototype=Object.assign(Object.create(qp.prototype),{constructor:td,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let l=t*o;for(let c=l+o;l!==c;l+=4)Xn.slerpFlat(i,0,s,l-o,s,l,a);return i}});class ed extends Jp{InterpolantFactoryMethodLinear(t){return new td(this.times,this.values,this.getValueSize(),t)}}exports.QuaternionKeyframeTrack=ed,ed.prototype.ValueTypeName="quaternion",ed.prototype.DefaultInterpolation=Oe,ed.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends Jp{}exports.StringKeyframeTrack=nd,nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=Fe,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends Jp{}exports.VectorKeyframeTrack=rd,rd.prototype.ValueTypeName="vector";class id{constructor(t,e=-1,n,r=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Fn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(od(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(Jp.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];jp.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let c=0;c0||0===t.search(/^data\:image\/jpeg/);i.format=r?Bt:Nt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(yd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)i+=(n=this.getPoint(s/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,l=i-1;for(;a<=l;)if((o=n[r=Math.floor(a+(l-a)/2)]-s)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(i-1);const c=n[r];return(r+(s-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),s=this.getPoint(r),o=e||(i.isVector2?new On:new Yn);return o.copy(s).sub(i).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,r=[],i=[],s=[],o=new Yn,a=new wr;for(let p=0;p<=t;p++){const e=p/t;r[p]=this.getTangentAt(e,new Yn),r[p].normalize()}i[0]=new Yn,s[0]=new Yn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let p=1;p<=t;p++){if(i[p]=i[p-1].clone(),s[p]=s[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Fn.clamp(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(a.makeRotationAxis(o,t))}s[p].crossVectors(r[p],i[p])}if(!0===e){let e=Math.acos(Fn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class _d extends yd{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new On,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?o=r[(l-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),o=Md);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return n.set(Ld(o,a.x,l.x,c.x,h.x),Ld(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[r]-e,i=this.curves[r],s=i.getLength(),o=0===s?0:1-t/s;return i.getPointAt(o)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}exports.Path=Xd;class Yd extends Xd{constructor(t){super(t),this.uuid=Fn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new xi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new On).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new Yn).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Wn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new zn).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new wr).fromArray(e.value);break;default:r.uniforms[i].value=e.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const i in t.extensions)r.extensions[i]=t.extensions[i];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new On).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new On).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}exports.MaterialLoader=fm;const gm={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r0){const n=new ld(e);(i=new fd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[i],l=-l),t.yo.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=dp.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],(l=new Yd).curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let x=0,v=s.length;x1){let t=!1;const e=[];for(let n=0,r=p.length;n0&&(t||(f=u))}for(let x=0,v=p.length;x0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,l=e+e;a!==l;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){Xn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;Xn.multiplyQuaternionsFlat(t,s,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}exports.PropertyMixer=Km;const $m="\\[\\]\\.:\\/",tf=new RegExp("[\\[\\]\\.:\\/]","g"),ef="[^\\[\\]\\.:\\/]",nf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",rf=/((?:WC+[\/:])*)/.source.replace("WC",ef),sf=/(WCOD+)?/.source.replace("WCOD",nf),of=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ef),af=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ef),lf=new RegExp("^"+rf+sf+of+af+"$"),cf=["material","materials","bones"];function hf(t,e,n){const r=n||uf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function uf(t,e,n){this.path=e,this.parsedPath=n||uf.parseTrackName(e),this.node=uf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(hf.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(uf,{Composite:hf,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new uf.Composite(t,e,n):new uf(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(tf,"")},parseTrackName:function(t){const e=lf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==cf.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r=i){const s=i++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[l];e[l]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(h);for(let u=c,p=a.length;u!==p;++u){const n=a[u];h[u]=new uf(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}exports.AnimationObjectGroup=pf,pf.prototype.isAnimationObjectGroup=!0;class df{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:Ge,endingEnd:Ge};for(let l=0;l!==s;++l){const t=i[l].createInterpolant(null);o[l]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Be,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=i,a[1]=i+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case ke:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===Ne;if(0===t)return-1===i?r:s&&1==(1&i)?e-r:r;if(n===Ie){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=He,r.endingEnd=He):(r.endingStart=t?this.zeroSlopeAtStart?He:Ge:Ue,r.endingEnd=e?this.zeroSlopeAtEnd?He:Ge:Ue)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class mf extends In{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let h=0;h!==i;++h){const t=r[h],i=t.name;let l=c[i];if(void 0!==l)s[h]=l;else{if(void 0!==(l=s[h])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,i));continue}const r=e&&e._propertyBindings[h].binding.parsedPath;++(l=new Km(uf.create(n,i,r),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(l,a,i),s[h]=l}o[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l){e[l]._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let l=0;l!==a;++l)o[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new On),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new On),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Mf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=Sf,Sf.prototype.isBox2=!0;const Tf=new Yn,Ef=new Yn;class Af{constructor(t=new Yn,e=new Yn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tf.subVectors(t,this.start),Ef.subVectors(this.end,this.start);const n=Ef.dot(Ef);let r=Ef.dot(Tf)/n;return e&&(r=Fn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Lf(t){Xr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=Af,Lf.prototype=Object.create(Xr.prototype),Lf.prototype.constructor=Lf,Lf.prototype.isImmediateRenderObject=!0;const Rf=new Yn;class Cf extends Xr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ki,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,o=1,a=32;s.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eg,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=ig;class sg extends pu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ki;n.setAttribute("position",new Ci(e,3)),n.setAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=sg;const og=new Float32Array(1),ag=new Int32Array(og.buffer),lg={toHalfFloat:function(t){og[0]=t;const e=ag[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}};exports.DataUtils=lg;const cg=4,hg=8,ug=Math.pow(2,hg),pg=[.125,.215,.35,.446,.526,.582],dg=hg-cg+1+pg.length,mg=20,fg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},gg=new vi({side:p,depthWrite:!1,depthTest:!1}),xg=new os(new cs,gg),vg=new lm,{_lodPlanes:yg,_sizeLods:_g,_sigmas:bg}=Cg(),wg=new xi;let Mg=null;const Sg=(1+Math.sqrt(5))/2,Tg=1/Sg,Eg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Sg,Tg),new Yn(0,Sg,-Tg),new Yn(Tg,0,Sg),new Yn(-Tg,0,Sg),new Yn(Sg,Tg,0),new Yn(-Sg,Tg,0)];function Ag(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Lg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Ig(mg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Mg=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ng(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?ug:0,ug,ug),a.setRenderTarget(r),u&&a.render(xg,i),a.render(t,i)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ng()):null==this._equirectShader&&(this._equirectShader=Bg());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new os(yg[0],r),s=r.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=fg[t.encoding],s.outputEncoding.value=fg[e.texture.encoding],Dg(e,0,0,3*ug,2*ug),n.setRenderTarget(e),n.render(i,vg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;rmg&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${mg}`);const f=[];let g=0;for(let v=0;vhg-cg?r-hg+cg:0),3*x,2*x),a.setRenderTarget(e),a.render(c,vg)}}function Rg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Cg(){const t=[],e=[],n=[];let r=hg;for(let i=0;ihg-cg?o=pg[i-hg+cg-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),x=new Float32Array(m*p*u),v=new Float32Array(f*p*u);for(let t=0;t2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*p*t),x.set(h,m*p*t);const i=[t,t,t,t,t,t];v.set(i,f*p*t)}const y=new ki;y.setAttribute("position",new bi(g,d)),y.setAttribute("uv",new bi(x,m)),y.setAttribute("faceIndex",new bi(v,f)),t.push(y),r>cg&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pg(t){const e=new jn(3*ug,3*ug,t);return e.texture.mapping=ot,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dg(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ig(t){const e=new Float32Array(t),n=new Yn(0,1,0);return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Og()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Bg(){const t=new On(1,1);return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Og()}\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Ng(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Og()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Fg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Og(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}exports.PMREMGenerator=Lg;const zg=0;exports.LineStrip=0;const Gg=1;exports.LinePieces=1;const Hg=0;exports.NoColors=0;const Ug=1;exports.FaceColors=1;const kg=2;function Vg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Wg(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function jg(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yu(t,e)}function qg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Oh(t)}function Xg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yu(t,e)}function Yg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Zg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Jg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Qg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Kg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new bi(t,e).setUsage(Mn)}function $g(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wi(t,e)}function tx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mi(t,e)}function ex(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function nx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ti(t,e)}function rx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ei(t,e)}function ix(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ai(t,e)}function sx(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Li(t,e)}function ox(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function ax(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Pi(t,e)}function lx(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new sg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Kf(t,e)}function hx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pu(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pu(new Dp(t.geometry),new ru({color:void 0!==e?e:16777215}))}function px(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pd(t)}function dx(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xd(t)}function mx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ws(t,n)}function fx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.VertexColors=2,yd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(yd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hd.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gm.extractUrlBase(t)},hd.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Sf.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Sf.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Sf.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sf.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Qn.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},dr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Af.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Fn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Fn.floorPowerOfTwo(t)},Fn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Fn.ceilPowerOfTwo(t)},zn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},zn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},zn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},zn.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wr.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},wr.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},wr.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},wr.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},wr.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},wr.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},wr.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},wr.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},wr.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},wr.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},wr.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},wr.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},wr.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},wr.prototype.makeFrustum=function(t,e,n,r,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,s)},wr.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Qr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Xn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Xn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},br.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},br.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},br.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},li.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},li.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},li.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},li.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},li.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},li.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),li.getBarycoord(t,e,n,r,i)},li.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),li.getNormal(t,e,n,r)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Sp(this,t)},On.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},On.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},On.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Yn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Yn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Yn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Yn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Yn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Yn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Yn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Yn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Yn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Wn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),os.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(os.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Uh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Qh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Xh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(yd.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),xs.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zd.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(bi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),bi.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},bi.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},bi.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ki.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ki.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new bi(arguments[1],arguments[2])))},ki.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ki.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ki.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ki.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ki.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ki.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(xm.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(vf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(_h.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),_h.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},_h.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},gp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},gp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},yh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(ff.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(hi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(zp.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Op.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(fs.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),fh.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},fh.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},fh.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},fh.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},fh.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},fh.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},fh.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},fh.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},fh.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},fh.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},fh.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},fh.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},fh.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},fh.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},fh.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},fh.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},fh.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},fh.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},fh.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},fh.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},fh.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},fh.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},fh.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},fh.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},fh.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(fh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(jm.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Dm).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_s.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},_s.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new vd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new gd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126"); },{}],"xTGv":[function(require,module,exports) { @@ -541,15 +541,15 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.accumulatedTriangles,n=void 0===o?new Set:o,u=t.accumulatedIndices,a=void 0===u?new Set:u,d=t.accumulatedTraversedNodeIndices,c=void 0===d?new Set:d,m=t.accumulatedEndNodeIndices,p=void 0===m?new Set:m,f=new l.Matrix4;f.copy(i.matrixWorld).invert();var q=new l.Sphere;q.center.copy(e).applyMatrix4(f),q.radius=M.size;var y=new Set,g=new l.Vector3,h=new l.Vector3,b=i.geometry.index,v=i.geometry.attributes.position,x=i.geometry.attributes.normal,S=new Set;i.geometry.boundsTree.shapecast(i,{intersectsBounds:function(e,r,s,t,o){c.add(o);var i=q.intersectsBox(e),n=e.min,u=e.max;if(i){for(var a=0;a<=1;a++)for(var d=0;d<=1;d++)for(var l=0;l<=1;l++)if(g.set(0===a?n.x:u.x,0===d?n.y:u.y,0===l?n.z:u.z),!q.containsPoint(g))return j.INTERSECTED;return j.CONTAINED}return i?j.INTERSECTED:j.NOT_INTERSECTED},intersectsRange:function(e,r,s,t,o){p.add(o)},intersectsTriangle:function(e,r,s){var t=r;S.add(t),n.add(t);var o=3*r,i=o+0,u=o+1,d=o+2,c=b.getX(i),l=b.getX(u),m=b.getX(d);return s?(y.add(c),y.add(l),y.add(m),a.add(c),a.add(l),a.add(m)):(q.containsPoint(e.a)&&(y.add(c),a.add(c)),q.containsPoint(e.b)&&(y.add(l),a.add(l)),q.containsPoint(e.c)&&(y.add(m),a.add(m))),!1}});var B=new l.Vector3;B.copy(e).applyMatrix4(f);var z=new l.Vector3,E=0;if(y.forEach(function(e){g.fromBufferAttribute(x,e),h.add(g),s||(E++,g.fromBufferAttribute(v,e),z.add(g))}),h.normalize(),r.quaternion.setFromUnitVectors(w,h),E&&z.multiplyScalar(1/E),!s){var T=1e-4*M.intensity,P=new l.Plane;P.setFromNormalAndCoplanarPoint(h,z),y.forEach(function(e){g.fromBufferAttribute(v,e);var r=g.distanceTo(B),s=M.invert?-1:1,t=1-r/M.size;if("clay"===M.brush){t=Math.pow(t,3);var o=P.distanceToPoint(g),i=s*Math.min(4*t,1);g.addScaledVector(h,i*T-s*o*i*.3)}else if("normal"===M.brush)t=Math.pow(t,2),g.addScaledVector(h,s*t*T);else if("flatten"===M.brush){t=Math.pow(t,2);var n=P.distanceToPoint(g);g.addScaledVector(h,-n*t*M.intensity*.01*.5)}v.setXYZ(e,g.x,g.y,g.z),x.setXYZ(e,0,0,0)}),y.size&&(v.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,u=i.geometry.attributes.normal,a=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),p=o.getX(c),j=o.getX(l);a.a.fromBufferAttribute(n,m),a.b.fromBufferAttribute(n,p),a.c.fromBufferAttribute(n,j),a.getNormal(t),r.has(m)&&(s.fromBufferAttribute(u,m),s.add(t),u.setXYZ(m,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(u,p),s.add(t),u.setXYZ(p,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(u,j),s.add(t),u.setXYZ(j,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(u,e),s.normalize(),u.setXYZ(e,s.x,s.y,s.z)}),u.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active||!h)n.visible=!1,u.visible=!1,B.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(b,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(M.size,M.size,.1),n.position.copy(c.point),u.visible=M.symmetrical,u.scale.set(M.size,M.size,.1),u.position.copy(c.point),u.position.x*=-1,o.enabled=!1,B.x===1/0&&B.copy(c.point),x||S){for(var m=(b.x-v.x)*window.innerWidth*window.devicePixelRatio,p=(b.y-v.y)*window.innerHeight*window.devicePixelRatio,j=Math.sqrt(m*m+p*p),f=c.point.distanceTo(B),q=.15*M.size,y=Math.max(q/f,1/M.maxSteps),g=j*y,w=0,z=new Set,E=new Set,C=new Set,H=new Set,O={accumulatedTriangles:z,accumulatedIndices:E,accumulatedTraversedNodeIndices:C,accumulatedEndNodeIndices:H};f>q&&j>200*M.size/c.distance&&(v.lerp(b,y),B.lerp(c.point,y),f-=q,j-=g,T(B,n,!1,O),M.symmetrical&&(B.x*=-1,T(B,u,!1,O),B.x*=-1),!(++w>M.maxSteps)););w>0?(P(z,E),i.geometry.boundsTree.refit(C,H),null!==a.parent&&a.update()):(T(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,T(c.point,u,!0),c.point.x*=-1))}else T(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,T(c.point,u,!0),c.point.x*=-1),v.copy(b),B.copy(c.point);else o.enabled=!0,n.visible=!1,u.visible=!1,v.copy(b),B.setScalar(1/0)}S=x,t.render(r,s),e.end()}E(),V(); -},{"core-js/modules/es6.array.copy-within":"tWTB","core-js/modules/es6.array.fill":"hUQ6","core-js/modules/es6.array.find":"Qppk","core-js/modules/es6.array.find-index":"sVmK","core-js/modules/es7.array.flat-map":"I8vV","core-js/modules/es6.array.from":"RRcs","core-js/modules/es7.array.includes":"TLss","core-js/modules/es6.array.iterator":"wVEN","core-js/modules/es6.array.of":"RB6b","core-js/modules/es6.array.sort":"nrVf","core-js/modules/es6.array.species":"smn3","core-js/modules/es6.date.to-json":"Gj6n","core-js/modules/es6.date.to-primitive":"jQnQ","core-js/modules/es6.function.has-instance":"a7bX","core-js/modules/es6.function.name":"N3yi","core-js/modules/es6.map":"ioKM","core-js/modules/es6.math.acosh":"py3M","core-js/modules/es6.math.asinh":"ob11","core-js/modules/es6.math.atanh":"iUik","core-js/modules/es6.math.cbrt":"YRuK","core-js/modules/es6.math.clz32":"R2Qc","core-js/modules/es6.math.cosh":"nEse","core-js/modules/es6.math.expm1":"AmoX","core-js/modules/es6.math.fround":"vmlq","core-js/modules/es6.math.hypot":"kLut","core-js/modules/es6.math.imul":"A8J8","core-js/modules/es6.math.log1p":"qtpC","core-js/modules/es6.math.log10":"VUW8","core-js/modules/es6.math.log2":"Jo9J","core-js/modules/es6.math.sign":"mZl9","core-js/modules/es6.math.sinh":"m0zb","core-js/modules/es6.math.tanh":"Fnqw","core-js/modules/es6.math.trunc":"tiOR","core-js/modules/es6.number.constructor":"kRGG","core-js/modules/es6.number.epsilon":"DzYy","core-js/modules/es6.number.is-finite":"FuY7","core-js/modules/es6.number.is-integer":"pwRL","core-js/modules/es6.number.is-nan":"SsgJ","core-js/modules/es6.number.is-safe-integer":"qVIE","core-js/modules/es6.number.max-safe-integer":"shx2","core-js/modules/es6.number.min-safe-integer":"ifBH","core-js/modules/es6.number.parse-float":"yjyf","core-js/modules/es6.number.parse-int":"Guno","core-js/modules/es6.object.assign":"K3Jy","core-js/modules/es7.object.define-getter":"guoQ","core-js/modules/es7.object.define-setter":"HMp9","core-js/modules/es7.object.entries":"gxEP","core-js/modules/es6.object.freeze":"EO7q","core-js/modules/es6.object.get-own-property-descriptor":"nIty","core-js/modules/es7.object.get-own-property-descriptors":"BQD8","core-js/modules/es6.object.get-own-property-names":"i23Y","core-js/modules/es6.object.get-prototype-of":"ud3u","core-js/modules/es7.object.lookup-getter":"HB2g","core-js/modules/es7.object.lookup-setter":"QF5J","core-js/modules/es6.object.prevent-extensions":"llMc","core-js/modules/es6.object.to-string":"zTK3","core-js/modules/es6.object.is":"MlqR","core-js/modules/es6.object.is-frozen":"Z1rp","core-js/modules/es6.object.is-sealed":"Fckj","core-js/modules/es6.object.is-extensible":"EYbC","core-js/modules/es6.object.keys":"m9aB","core-js/modules/es6.object.seal":"GYFR","core-js/modules/es6.object.set-prototype-of":"JGjq","core-js/modules/es7.object.values":"Ltmz","core-js/modules/es6.promise":"Pjta","core-js/modules/es7.promise.finally":"l1j0","core-js/modules/es6.reflect.apply":"F0Xu","core-js/modules/es6.reflect.construct":"JlFO","core-js/modules/es6.reflect.define-property":"S841","core-js/modules/es6.reflect.delete-property":"JRlJ","core-js/modules/es6.reflect.get":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor":"zj1X","core-js/modules/es6.reflect.get-prototype-of":"d0aC","core-js/modules/es6.reflect.has":"OWTq","core-js/modules/es6.reflect.is-extensible":"deHu","core-js/modules/es6.reflect.own-keys":"e6SV","core-js/modules/es6.reflect.prevent-extensions":"BmyK","core-js/modules/es6.reflect.set":"K46i","core-js/modules/es6.reflect.set-prototype-of":"L5z5","core-js/modules/es6.regexp.constructor":"BenF","core-js/modules/es6.regexp.flags":"pDhD","core-js/modules/es6.regexp.match":"RTfC","core-js/modules/es6.regexp.replace":"KGao","core-js/modules/es6.regexp.split":"aOHf","core-js/modules/es6.regexp.search":"zOab","core-js/modules/es6.regexp.to-string":"iflU","core-js/modules/es6.set":"coyu","core-js/modules/es6.symbol":"uVn9","core-js/modules/es7.symbol.async-iterator":"DlMC","core-js/modules/es6.string.anchor":"USd7","core-js/modules/es6.string.big":"c1D0","core-js/modules/es6.string.blink":"Ee86","core-js/modules/es6.string.bold":"ry39","core-js/modules/es6.string.code-point-at":"zR9y","core-js/modules/es6.string.ends-with":"zRn7","core-js/modules/es6.string.fixed":"AHLq","core-js/modules/es6.string.fontcolor":"H7V0","core-js/modules/es6.string.fontsize":"Dx83","core-js/modules/es6.string.from-code-point":"xSM3","core-js/modules/es6.string.includes":"fH7p","core-js/modules/es6.string.italics":"fRhg","core-js/modules/es6.string.iterator":"tbKg","core-js/modules/es6.string.link":"Aaz0","core-js/modules/es7.string.pad-start":"SWNE","core-js/modules/es7.string.pad-end":"n20m","core-js/modules/es6.string.raw":"t29D","core-js/modules/es6.string.repeat":"C85R","core-js/modules/es6.string.small":"qBr3","core-js/modules/es6.string.starts-with":"w2SA","core-js/modules/es6.string.strike":"eNyu","core-js/modules/es6.string.sub":"BVLK","core-js/modules/es6.string.sup":"kMsL","core-js/modules/es7.string.trim-left":"ppxd","core-js/modules/es7.string.trim-right":"hxx1","core-js/modules/es6.typed.array-buffer":"NJ0a","core-js/modules/es6.typed.int8-array":"wqMZ","core-js/modules/es6.typed.uint8-array":"QTtY","core-js/modules/es6.typed.uint8-clamped-array":"Kqgs","core-js/modules/es6.typed.int16-array":"fEGw","core-js/modules/es6.typed.uint16-array":"xyd6","core-js/modules/es6.typed.int32-array":"hIko","core-js/modules/es6.typed.uint32-array":"tNPN","core-js/modules/es6.typed.float32-array":"wisA","core-js/modules/es6.typed.float64-array":"mbTX","core-js/modules/es6.weak-map":"D6DP","core-js/modules/es6.weak-set":"bRUR","core-js/modules/web.timers":"OTsy","core-js/modules/web.immediate":"hZLH","core-js/modules/web.dom.iterable":"v6Aj","regenerator-runtime/runtime":"QVnC","stats.js/src/Stats":"RDO9","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","../src/index.js":"uBxZ"}]},{},["ODOB"], null) \ No newline at end of file +},{"three":"dKqR","./MeshBVH.js":"nIyY","./MeshBVHVisualizer.js":"jNwr","./Constants.js":"tuIt","./Utils/Debug.js":"uNJb","./MeshBVHDebug.js":"HxoX"}],"QVnC":[function(require,module,exports) { +var define; +var t,r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(P){u=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof d?r:d,i=Object.create(o.prototype),a=new G(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return F()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=j(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:s,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(P){return{type:"throw",arg:P}}}t.wrap=h;var l="suspendedStart",s="suspendedYield",p="executing",y="completed",v={};function d(){}function g(){}function m(){}var w={};w[i]=function(){return this};var L=Object.getPrototypeOf,x=L&&L(L(N([])));x&&x!==e&&n.call(x,i)&&(w=x);var b=m.prototype=d.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(r){u(t,r,function(t){return this._invoke(r,t)})})}function _(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(l).then(function(t){h.value=t,a(h)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function j(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} +},{}],"ODOB":[function(require,module,exports) { +"use strict";require("core-js/modules/es6.array.copy-within.js"),require("core-js/modules/es6.array.fill.js"),require("core-js/modules/es6.array.filter.js"),require("core-js/modules/es6.array.find.js"),require("core-js/modules/es6.array.find-index.js"),require("core-js/modules/es7.array.flat-map.js"),require("core-js/modules/es6.array.from.js"),require("core-js/modules/es7.array.includes.js"),require("core-js/modules/es6.array.iterator.js"),require("core-js/modules/es6.array.map.js"),require("core-js/modules/es6.array.of.js"),require("core-js/modules/es6.array.slice.js"),require("core-js/modules/es6.array.sort.js"),require("core-js/modules/es6.array.species.js"),require("core-js/modules/es6.date.to-primitive.js"),require("core-js/modules/es6.function.has-instance.js"),require("core-js/modules/es6.function.name.js"),require("core-js/modules/es6.map.js"),require("core-js/modules/es6.math.acosh.js"),require("core-js/modules/es6.math.asinh.js"),require("core-js/modules/es6.math.atanh.js"),require("core-js/modules/es6.math.cbrt.js"),require("core-js/modules/es6.math.clz32.js"),require("core-js/modules/es6.math.cosh.js"),require("core-js/modules/es6.math.expm1.js"),require("core-js/modules/es6.math.fround.js"),require("core-js/modules/es6.math.hypot.js"),require("core-js/modules/es6.math.imul.js"),require("core-js/modules/es6.math.log1p.js"),require("core-js/modules/es6.math.log10.js"),require("core-js/modules/es6.math.log2.js"),require("core-js/modules/es6.math.sign.js"),require("core-js/modules/es6.math.sinh.js"),require("core-js/modules/es6.math.tanh.js"),require("core-js/modules/es6.math.trunc.js"),require("core-js/modules/es6.number.constructor.js"),require("core-js/modules/es6.number.epsilon.js"),require("core-js/modules/es6.number.is-finite.js"),require("core-js/modules/es6.number.is-integer.js"),require("core-js/modules/es6.number.is-nan.js"),require("core-js/modules/es6.number.is-safe-integer.js"),require("core-js/modules/es6.number.max-safe-integer.js"),require("core-js/modules/es6.number.min-safe-integer.js"),require("core-js/modules/es6.number.parse-float.js"),require("core-js/modules/es6.number.parse-int.js"),require("core-js/modules/es6.object.assign.js"),require("core-js/modules/es7.object.define-getter.js"),require("core-js/modules/es7.object.define-setter.js"),require("core-js/modules/es7.object.entries.js"),require("core-js/modules/es6.object.freeze.js"),require("core-js/modules/es6.object.get-own-property-descriptor.js"),require("core-js/modules/es7.object.get-own-property-descriptors.js"),require("core-js/modules/es6.object.get-own-property-names.js"),require("core-js/modules/es6.object.get-prototype-of.js"),require("core-js/modules/es7.object.lookup-getter.js"),require("core-js/modules/es7.object.lookup-setter.js"),require("core-js/modules/es6.object.prevent-extensions.js"),require("core-js/modules/es6.object.to-string.js"),require("core-js/modules/es6.object.is.js"),require("core-js/modules/es6.object.is-frozen.js"),require("core-js/modules/es6.object.is-sealed.js"),require("core-js/modules/es6.object.is-extensible.js"),require("core-js/modules/es6.object.keys.js"),require("core-js/modules/es6.object.seal.js"),require("core-js/modules/es7.object.values.js"),require("core-js/modules/es6.promise.js"),require("core-js/modules/es7.promise.finally.js"),require("core-js/modules/es6.reflect.apply.js"),require("core-js/modules/es6.reflect.construct.js"),require("core-js/modules/es6.reflect.define-property.js"),require("core-js/modules/es6.reflect.delete-property.js"),require("core-js/modules/es6.reflect.get.js"),require("core-js/modules/es6.reflect.get-own-property-descriptor.js"),require("core-js/modules/es6.reflect.get-prototype-of.js"),require("core-js/modules/es6.reflect.has.js"),require("core-js/modules/es6.reflect.is-extensible.js"),require("core-js/modules/es6.reflect.own-keys.js"),require("core-js/modules/es6.reflect.prevent-extensions.js"),require("core-js/modules/es6.reflect.set.js"),require("core-js/modules/es6.reflect.set-prototype-of.js"),require("core-js/modules/es6.regexp.constructor.js"),require("core-js/modules/es6.regexp.flags.js"),require("core-js/modules/es6.regexp.match.js"),require("core-js/modules/es6.regexp.replace.js"),require("core-js/modules/es6.regexp.split.js"),require("core-js/modules/es6.regexp.search.js"),require("core-js/modules/es6.regexp.to-string.js"),require("core-js/modules/es6.set.js"),require("core-js/modules/es6.symbol.js"),require("core-js/modules/es7.symbol.async-iterator.js"),require("core-js/modules/es6.string.anchor.js"),require("core-js/modules/es6.string.big.js"),require("core-js/modules/es6.string.blink.js"),require("core-js/modules/es6.string.bold.js"),require("core-js/modules/es6.string.code-point-at.js"),require("core-js/modules/es6.string.ends-with.js"),require("core-js/modules/es6.string.fixed.js"),require("core-js/modules/es6.string.fontcolor.js"),require("core-js/modules/es6.string.fontsize.js"),require("core-js/modules/es6.string.from-code-point.js"),require("core-js/modules/es6.string.includes.js"),require("core-js/modules/es6.string.italics.js"),require("core-js/modules/es6.string.iterator.js"),require("core-js/modules/es6.string.link.js"),require("core-js/modules/es7.string.pad-start.js"),require("core-js/modules/es7.string.pad-end.js"),require("core-js/modules/es6.string.raw.js"),require("core-js/modules/es6.string.repeat.js"),require("core-js/modules/es6.string.small.js"),require("core-js/modules/es6.string.starts-with.js"),require("core-js/modules/es6.string.strike.js"),require("core-js/modules/es6.string.sub.js"),require("core-js/modules/es6.string.sup.js"),require("core-js/modules/es7.string.trim-left.js"),require("core-js/modules/es7.string.trim-right.js"),require("core-js/modules/es6.typed.array-buffer.js"),require("core-js/modules/es6.typed.int8-array.js"),require("core-js/modules/es6.typed.uint8-array.js"),require("core-js/modules/es6.typed.uint8-clamped-array.js"),require("core-js/modules/es6.typed.int16-array.js"),require("core-js/modules/es6.typed.uint16-array.js"),require("core-js/modules/es6.typed.int32-array.js"),require("core-js/modules/es6.typed.uint32-array.js"),require("core-js/modules/es6.typed.float32-array.js"),require("core-js/modules/es6.typed.float64-array.js"),require("core-js/modules/es6.weak-map.js"),require("core-js/modules/es6.weak-set.js"),require("core-js/modules/web.timers.js"),require("core-js/modules/web.immediate.js"),require("core-js/modules/web.dom.iterable.js");var e,r,s,t,o,i,n,a,u,d=y(require("stats.js/src/Stats")),c=q(require("dat.gui")),l=q(require("three")),m=require("three/examples/jsm/controls/OrbitControls.js"),j=require("three/examples/jsm/utils/BufferGeometryUtils.js"),p=require("../src/index.js");function f(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,s=new WeakMap;return(f=function(e){return e?s:r})(e)}function q(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var s=f(r);if(s&&s.has(e))return s.get(e);var t={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var n=o?Object.getOwnPropertyDescriptor(e,i):null;n&&(n.get||n.set)?Object.defineProperty(t,i,n):t[i]=e[i]}return t.default=e,s&&s.set(e,t),t}function y(e){return e&&e.__esModule?e:{default:e}}require("regenerator-runtime/runtime.js"),l.Mesh.prototype.raycast=p.acceleratedRaycast,l.BufferGeometry.prototype.computeBoundsTree=p.computeBoundsTree,l.BufferGeometry.prototype.disposeBoundsTree=p.disposeBoundsTree;var g,w=new l.Vector3(0,0,1),h=!1,b=new l.Vector2,v=new l.Vector2,x=!1,S=!1,B=new l.Vector3,M={size:.1,brush:"clay",intensity:50,maxSteps:10,invert:!1,symmetrical:!0,flatShading:!1,depth:10,displayHelper:!1};function z(){i&&(i.geometry.dispose(),i.material.dispose(),r.remove(i)),g||(g=(new l.TextureLoader).load("../textures/skinHazardousarts2.jpg"));var e=new l.IcosahedronBufferGeometry(1,100);e.deleteAttribute("uv"),(e=j.BufferGeometryUtils.mergeVertices(e)).attributes.position.setUsage(l.DynamicDrawUsage),e.attributes.normal.setUsage(l.DynamicDrawUsage),e.computeBoundsTree({setBoundingBox:!1}),(i=new l.Mesh(e,new l.MeshMatcapMaterial({flatShading:M.flatShading,matcap:g}))).material.matcap.encoding=l.sRGBEncoding,i.frustumCulled=!1,r.add(i),u||(u=new p.MeshBVHVisualizer(i,M.depth),M.displayHelper&&r.add(u)),u.mesh=i,u.update()}function E(){(t=new l.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),t.setSize(window.innerWidth,window.innerHeight),t.setClearColor(1251612,1),t.gammaOutput=!0,document.body.appendChild(t.domElement),t.domElement.style.touchAction="none",(r=new l.Scene).fog=new l.Fog(1251612,20,60);var j=new l.DirectionalLight(16777215,.5);j.position.set(1,1,1),r.add(j),r.add(new l.AmbientLight(16777215,.4)),z();for(var p=[new l.Vector3,new l.Vector3(0,0,1)],f=0;f<50;f++){var q=f+1,y=Math.sin(2*Math.PI*f/50),g=Math.cos(2*Math.PI*f/50),w=Math.sin(2*Math.PI*q/50),v=Math.cos(2*Math.PI*q/50);p.push(new l.Vector3(y,g,0),new l.Vector3(w,v,0))}(n=new l.LineSegments).geometry.setFromPoints(p),n.material.color.set(16485376),r.add(n),a=n.clone(),r.add(a),(s=new l.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,3),s.far=100,s.updateProjectionMatrix(),e=new d.default,document.body.appendChild(e.dom);var S=new c.GUI,B=S.addFolder("Sculpting");B.add(M,"brush",["normal","clay","flatten"]),B.add(M,"size").min(.025).max(.25).step(.005),B.add(M,"intensity").min(1).max(100).step(1),B.add(M,"maxSteps").min(1).max(25).step(1),B.add(M,"symmetrical"),B.add(M,"invert"),B.add(M,"flatShading").onChange(function(e){i.material.flatShading=e,i.material.needsUpdate=!0}),B.open();var E=S.addFolder("BVH Helper");E.add(M,"depth").min(1).max(20).step(1).onChange(function(e){u.depth=parseFloat(e),u.update()}),E.add(M,"displayHelper").onChange(function(e){e?(r.add(u),u.update()):r.remove(u)}),E.open(),S.add({reset:z},"reset"),S.add({rebuildBVH:function(){i.geometry.computeBoundsTree({setBoundingBox:!1}),u.update()}},"rebuildBVH"),S.open(),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("pointermove",function(e){b.x=e.clientX/window.innerWidth*2-1,b.y=-e.clientY/window.innerHeight*2+1,h=!0}),window.addEventListener("pointerdown",function(e){b.x=e.clientX/window.innerWidth*2-1,b.y=-e.clientY/window.innerHeight*2+1,x=Boolean(1&e.buttons),h=!0;var r=new l.Raycaster;r.setFromCamera(b,s),r.firstHitOnly=!0;var t=r.intersectObject(i);o.enabled=0===t.length},!0),window.addEventListener("pointerup",function(e){x=Boolean(1&e.buttons),"touch"===e.pointerType&&(h=!1)}),window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("wheel",function(e){var r=e.deltaY;1===e.deltaMode&&(r*=40),2===e.deltaMode&&(r*=40),M.size+=1e-4*r,M.size=Math.max(Math.min(M.size,.25),.025),S.updateDisplay()}),(o=new m.OrbitControls(s,t.domElement)).minDistance=1.5,o.addEventListener("start",function(){this.active=!0}),o.addEventListener("end",function(){this.active=!1})}function T(e,r){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.accumulatedTriangles,n=void 0===o?new Set:o,a=t.accumulatedIndices,u=void 0===a?new Set:a,d=t.accumulatedTraversedNodeIndices,c=void 0===d?new Set:d,m=t.accumulatedEndNodeIndices,j=void 0===m?new Set:m,f=new l.Matrix4;f.copy(i.matrixWorld).invert();var q=new l.Sphere;q.center.copy(e).applyMatrix4(f),q.radius=M.size;var y=new Set,g=new l.Vector3,h=new l.Vector3,b=i.geometry.index,v=i.geometry.attributes.position,x=i.geometry.attributes.normal,S=new Set;i.geometry.boundsTree.shapecast(i,{intersectsBounds:function(e,r,s,t,o){c.add(o);var i=q.intersectsBox(e),n=e.min,a=e.max;if(i){for(var u=0;u<=1;u++)for(var d=0;d<=1;d++)for(var l=0;l<=1;l++)if(g.set(0===u?n.x:a.x,0===d?n.y:a.y,0===l?n.z:a.z),!q.containsPoint(g))return p.INTERSECTED;return p.CONTAINED}return i?p.INTERSECTED:p.NOT_INTERSECTED},intersectsRange:function(e,r,s,t,o){j.add(o)},intersectsTriangle:function(e,r,s){var t=r;S.add(t),n.add(t);var o=3*r,i=o+0,a=o+1,d=o+2,c=b.getX(i),l=b.getX(a),m=b.getX(d);return s?(y.add(c),y.add(l),y.add(m),u.add(c),u.add(l),u.add(m)):(q.containsPoint(e.a)&&(y.add(c),u.add(c)),q.containsPoint(e.b)&&(y.add(l),u.add(l)),q.containsPoint(e.c)&&(y.add(m),u.add(m))),!1}});var B=new l.Vector3;B.copy(e).applyMatrix4(f);var z=new l.Vector3,E=0;if(y.forEach(function(e){g.fromBufferAttribute(x,e),h.add(g),s||(E++,g.fromBufferAttribute(v,e),z.add(g))}),h.normalize(),r.quaternion.setFromUnitVectors(w,h),E&&z.multiplyScalar(1/E),!s){var T=1e-4*M.intensity,P=new l.Plane;P.setFromNormalAndCoplanarPoint(h,z),y.forEach(function(e){g.fromBufferAttribute(v,e);var r=g.distanceTo(B),s=M.invert?-1:1,t=1-r/M.size;if("clay"===M.brush){t=Math.pow(t,3);var o=P.distanceToPoint(g),i=s*Math.min(4*t,1);g.addScaledVector(h,i*T-s*o*i*.3)}else if("normal"===M.brush)t=Math.pow(t,2),g.addScaledVector(h,s*t*T);else if("flatten"===M.brush){t=Math.pow(t,2);var n=P.distanceToPoint(g);g.addScaledVector(h,-n*t*M.intensity*.01*.5)}v.setXYZ(e,g.x,g.y,g.z),x.setXYZ(e,0,0,0)}),y.size&&(v.needsUpdate=!0)}}function P(e,r){var s=new l.Vector3,t=new l.Vector3,o=i.geometry.index,n=i.geometry.attributes.position,a=i.geometry.attributes.normal,u=new l.Triangle;e.forEach(function(e){var i=3*e,d=i+0,c=i+1,l=i+2,m=o.getX(d),j=o.getX(c),p=o.getX(l);u.a.fromBufferAttribute(n,m),u.b.fromBufferAttribute(n,j),u.c.fromBufferAttribute(n,p),u.getNormal(t),r.has(m)&&(s.fromBufferAttribute(a,m),s.add(t),a.setXYZ(m,s.x,s.y,s.z)),r.has(j)&&(s.fromBufferAttribute(a,j),s.add(t),a.setXYZ(j,s.x,s.y,s.z)),r.has(p)&&(s.fromBufferAttribute(a,p),s.add(t),a.setXYZ(p,s.x,s.y,s.z))}),r.forEach(function(e){s.fromBufferAttribute(a,e),s.normalize(),a.setXYZ(e,s.x,s.y,s.z)}),a.needsUpdate=!0}function V(){if(requestAnimationFrame(V),e.begin(),o.active||!h)n.visible=!1,a.visible=!1,B.setScalar(1/0);else{var d=new l.Raycaster;d.setFromCamera(b,s),d.firstHitOnly=!0;var c=d.intersectObject(i,!0)[0];if(c)if(n.visible=!0,n.scale.set(M.size,M.size,.1),n.position.copy(c.point),a.visible=M.symmetrical,a.scale.set(M.size,M.size,.1),a.position.copy(c.point),a.position.x*=-1,o.enabled=!1,B.x===1/0&&B.copy(c.point),x||S){for(var m=(b.x-v.x)*window.innerWidth*window.devicePixelRatio,j=(b.y-v.y)*window.innerHeight*window.devicePixelRatio,p=Math.sqrt(m*m+j*j),f=c.point.distanceTo(B),q=.15*M.size,y=Math.max(q/f,1/M.maxSteps),g=p*y,w=0,z=new Set,E=new Set,C=new Set,H=new Set,O={accumulatedTriangles:z,accumulatedIndices:E,accumulatedTraversedNodeIndices:C,accumulatedEndNodeIndices:H};f>q&&p>200*M.size/c.distance&&(v.lerp(b,y),B.lerp(c.point,y),f-=q,p-=g,T(B,n,!1,O),M.symmetrical&&(B.x*=-1,T(B,a,!1,O),B.x*=-1),!(++w>M.maxSteps)););w>0?(P(z,E),i.geometry.boundsTree.refit(C,H),null!==u.parent&&u.update()):(T(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,T(c.point,a,!0),c.point.x*=-1))}else T(c.point,n,!0),M.symmetrical&&(c.point.x*=-1,T(c.point,a,!0),c.point.x*=-1),v.copy(b),B.copy(c.point);else o.enabled=!0,n.visible=!1,a.visible=!1,v.copy(b),B.setScalar(1/0)}S=x,t.render(r,s),e.end()}E(),V(); +},{"core-js/modules/es6.array.copy-within.js":"tWTB","core-js/modules/es6.array.fill.js":"hUQ6","core-js/modules/es6.array.filter.js":"GyG6","core-js/modules/es6.array.find.js":"Qppk","core-js/modules/es6.array.find-index.js":"sVmK","core-js/modules/es7.array.flat-map.js":"I8vV","core-js/modules/es6.array.from.js":"RRcs","core-js/modules/es7.array.includes.js":"TLss","core-js/modules/es6.array.iterator.js":"wVEN","core-js/modules/es6.array.map.js":"RBsu","core-js/modules/es6.array.of.js":"RB6b","core-js/modules/es6.array.slice.js":"btFn","core-js/modules/es6.array.sort.js":"nrVf","core-js/modules/es6.array.species.js":"smn3","core-js/modules/es6.date.to-primitive.js":"jQnQ","core-js/modules/es6.function.has-instance.js":"a7bX","core-js/modules/es6.function.name.js":"N3yi","core-js/modules/es6.map.js":"ioKM","core-js/modules/es6.math.acosh.js":"py3M","core-js/modules/es6.math.asinh.js":"ob11","core-js/modules/es6.math.atanh.js":"iUik","core-js/modules/es6.math.cbrt.js":"YRuK","core-js/modules/es6.math.clz32.js":"R2Qc","core-js/modules/es6.math.cosh.js":"nEse","core-js/modules/es6.math.expm1.js":"AmoX","core-js/modules/es6.math.fround.js":"vmlq","core-js/modules/es6.math.hypot.js":"kLut","core-js/modules/es6.math.imul.js":"A8J8","core-js/modules/es6.math.log1p.js":"qtpC","core-js/modules/es6.math.log10.js":"VUW8","core-js/modules/es6.math.log2.js":"Jo9J","core-js/modules/es6.math.sign.js":"mZl9","core-js/modules/es6.math.sinh.js":"m0zb","core-js/modules/es6.math.tanh.js":"Fnqw","core-js/modules/es6.math.trunc.js":"tiOR","core-js/modules/es6.number.constructor.js":"kRGG","core-js/modules/es6.number.epsilon.js":"DzYy","core-js/modules/es6.number.is-finite.js":"FuY7","core-js/modules/es6.number.is-integer.js":"pwRL","core-js/modules/es6.number.is-nan.js":"SsgJ","core-js/modules/es6.number.is-safe-integer.js":"qVIE","core-js/modules/es6.number.max-safe-integer.js":"shx2","core-js/modules/es6.number.min-safe-integer.js":"ifBH","core-js/modules/es6.number.parse-float.js":"yjyf","core-js/modules/es6.number.parse-int.js":"Guno","core-js/modules/es6.object.assign.js":"K3Jy","core-js/modules/es7.object.define-getter.js":"guoQ","core-js/modules/es7.object.define-setter.js":"HMp9","core-js/modules/es7.object.entries.js":"gxEP","core-js/modules/es6.object.freeze.js":"EO7q","core-js/modules/es6.object.get-own-property-descriptor.js":"nIty","core-js/modules/es7.object.get-own-property-descriptors.js":"BQD8","core-js/modules/es6.object.get-own-property-names.js":"i23Y","core-js/modules/es6.object.get-prototype-of.js":"ud3u","core-js/modules/es7.object.lookup-getter.js":"HB2g","core-js/modules/es7.object.lookup-setter.js":"QF5J","core-js/modules/es6.object.prevent-extensions.js":"llMc","core-js/modules/es6.object.to-string.js":"zTK3","core-js/modules/es6.object.is.js":"MlqR","core-js/modules/es6.object.is-frozen.js":"Z1rp","core-js/modules/es6.object.is-sealed.js":"Fckj","core-js/modules/es6.object.is-extensible.js":"EYbC","core-js/modules/es6.object.keys.js":"m9aB","core-js/modules/es6.object.seal.js":"GYFR","core-js/modules/es7.object.values.js":"Ltmz","core-js/modules/es6.promise.js":"Pjta","core-js/modules/es7.promise.finally.js":"l1j0","core-js/modules/es6.reflect.apply.js":"F0Xu","core-js/modules/es6.reflect.construct.js":"JlFO","core-js/modules/es6.reflect.define-property.js":"S841","core-js/modules/es6.reflect.delete-property.js":"JRlJ","core-js/modules/es6.reflect.get.js":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor.js":"zj1X","core-js/modules/es6.reflect.get-prototype-of.js":"d0aC","core-js/modules/es6.reflect.has.js":"OWTq","core-js/modules/es6.reflect.is-extensible.js":"deHu","core-js/modules/es6.reflect.own-keys.js":"e6SV","core-js/modules/es6.reflect.prevent-extensions.js":"BmyK","core-js/modules/es6.reflect.set.js":"K46i","core-js/modules/es6.reflect.set-prototype-of.js":"L5z5","core-js/modules/es6.regexp.constructor.js":"BenF","core-js/modules/es6.regexp.flags.js":"pDhD","core-js/modules/es6.regexp.match.js":"RTfC","core-js/modules/es6.regexp.replace.js":"KGao","core-js/modules/es6.regexp.split.js":"aOHf","core-js/modules/es6.regexp.search.js":"zOab","core-js/modules/es6.regexp.to-string.js":"iflU","core-js/modules/es6.set.js":"coyu","core-js/modules/es6.symbol.js":"uVn9","core-js/modules/es7.symbol.async-iterator.js":"DlMC","core-js/modules/es6.string.anchor.js":"USd7","core-js/modules/es6.string.big.js":"c1D0","core-js/modules/es6.string.blink.js":"Ee86","core-js/modules/es6.string.bold.js":"ry39","core-js/modules/es6.string.code-point-at.js":"zR9y","core-js/modules/es6.string.ends-with.js":"zRn7","core-js/modules/es6.string.fixed.js":"AHLq","core-js/modules/es6.string.fontcolor.js":"H7V0","core-js/modules/es6.string.fontsize.js":"Dx83","core-js/modules/es6.string.from-code-point.js":"xSM3","core-js/modules/es6.string.includes.js":"fH7p","core-js/modules/es6.string.italics.js":"fRhg","core-js/modules/es6.string.iterator.js":"tbKg","core-js/modules/es6.string.link.js":"Aaz0","core-js/modules/es7.string.pad-start.js":"SWNE","core-js/modules/es7.string.pad-end.js":"n20m","core-js/modules/es6.string.raw.js":"t29D","core-js/modules/es6.string.repeat.js":"C85R","core-js/modules/es6.string.small.js":"qBr3","core-js/modules/es6.string.starts-with.js":"w2SA","core-js/modules/es6.string.strike.js":"eNyu","core-js/modules/es6.string.sub.js":"BVLK","core-js/modules/es6.string.sup.js":"kMsL","core-js/modules/es7.string.trim-left.js":"ppxd","core-js/modules/es7.string.trim-right.js":"hxx1","core-js/modules/es6.typed.array-buffer.js":"NJ0a","core-js/modules/es6.typed.int8-array.js":"wqMZ","core-js/modules/es6.typed.uint8-array.js":"QTtY","core-js/modules/es6.typed.uint8-clamped-array.js":"Kqgs","core-js/modules/es6.typed.int16-array.js":"fEGw","core-js/modules/es6.typed.uint16-array.js":"xyd6","core-js/modules/es6.typed.int32-array.js":"hIko","core-js/modules/es6.typed.uint32-array.js":"tNPN","core-js/modules/es6.typed.float32-array.js":"wisA","core-js/modules/es6.typed.float64-array.js":"mbTX","core-js/modules/es6.weak-map.js":"D6DP","core-js/modules/es6.weak-set.js":"bRUR","core-js/modules/web.timers.js":"OTsy","core-js/modules/web.immediate.js":"hZLH","core-js/modules/web.dom.iterable.js":"v6Aj","stats.js/src/Stats":"RDO9","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","../src/index.js":"uBxZ","regenerator-runtime/runtime.js":"QVnC"}]},{},["ODOB"], null) \ No newline at end of file diff --git a/example/bundle/selection.383a520f.js b/example/bundle/selection.383a520f.js index 181dffa82..b8df13574 100644 --- a/example/bundle/selection.383a520f.js +++ b/example/bundle/selection.383a520f.js @@ -4,7 +4,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var define; var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof e&&e.amd?e(n):t.Stats=n()}(this,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;to+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var l=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,s=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,s,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p,u,s,m),{dom:h,update:function(f,y){l=Math.min(l,f),i=Math.max(i,f),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(a(f)+" "+e+" ("+a(l)+"-"+a(i)+")",c,d),v.drawImage(h,p+o,u,s-o,m,p,u,s-o,m),v.fillRect(p+s-o,u,o,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p+s-o,u,o,a((1-f/y)*m))}}},e}); },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"xTGv":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MapControls=exports.OrbitControls=void 0;var e=require("../../../build/three.module.js"),t=function(t,n){var o,a,i,r,c,s;void 0===n&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=n,this.enabled=!0,this.target=new e.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return E.phi},this.getAzimuthalAngle=function(){return E.theta},this.listenToKeyEvents=function(e){e.addEventListener("keydown",Q),this._domElementKeyEvents=e},this.saveState=function(){u.target0.copy(u.target),u.position0.copy(u.object.position),u.zoom0=u.object.zoom},this.reset=function(){u.target.copy(u.target0),u.object.position.copy(u.position0),u.object.zoom=u.zoom0,u.object.updateProjectionMatrix(),u.dispatchEvent(l),u.update(),d=h.NONE},this.update=(o=new e.Vector3,a=(new e.Quaternion).setFromUnitVectors(t.up,new e.Vector3(0,1,0)),i=a.clone().invert(),r=new e.Vector3,c=new e.Quaternion,s=2*Math.PI,function(){var e=u.object.position;o.copy(e).sub(u.target),o.applyQuaternion(a),E.setFromVector3(o),u.autoRotate&&d===h.NONE&&R(2*Math.PI/60/60*u.autoRotateSpeed),u.enableDamping?(E.theta+=f.theta*u.dampingFactor,E.phi+=f.phi*u.dampingFactor):(E.theta+=f.theta,E.phi+=f.phi);var t=u.minAzimuthAngle,n=u.maxAzimuthAngle;return isFinite(t)&&isFinite(n)&&(t<-Math.PI?t+=s:t>Math.PI&&(t-=s),n<-Math.PI?n+=s:n>Math.PI&&(n-=s),E.theta=t<=n?Math.max(t,Math.min(n,E.theta)):E.theta>(t+n)/2?Math.max(t,E.theta):Math.min(n,E.theta)),E.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,E.phi)),E.makeSafe(),E.radius*=O,E.radius=Math.max(u.minDistance,Math.min(u.maxDistance,E.radius)),!0===u.enableDamping?u.target.addScaledVector(g,u.dampingFactor):u.target.add(g),o.setFromSpherical(E),o.applyQuaternion(i),e.copy(u.target).add(o),u.object.lookAt(u.target),!0===u.enableDamping?(f.theta*=1-u.dampingFactor,f.phi*=1-u.dampingFactor,g.multiplyScalar(1-u.dampingFactor)):(f.set(0,0,0),g.set(0,0,0)),O=1,!!(v||r.distanceToSquared(u.object.position)>b||8*(1-c.dot(u.object.quaternion))>b)&&(u.dispatchEvent(l),r.copy(u.object.position),c.copy(u.object.quaternion),v=!1,!0)}),this.dispose=function(){u.domElement.removeEventListener("contextmenu",te),u.domElement.removeEventListener("pointerdown",B),u.domElement.removeEventListener("wheel",q),u.domElement.removeEventListener("touchstart",J),u.domElement.removeEventListener("touchend",ee),u.domElement.removeEventListener("touchmove",$),u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),null!==u._domElementKeyEvents&&u._domElementKeyEvents.removeEventListener("keydown",Q)};var u=this,l={type:"change"},m={type:"start"},p={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,b=1e-6,E=new e.Spherical,f=new e.Spherical,O=1,g=new e.Vector3,v=!1,T=new e.Vector2,y=new e.Vector2,P=new e.Vector2,L=new e.Vector2,w=new e.Vector2,A=new e.Vector2,N=new e.Vector2,M=new e.Vector2,j=new e.Vector2;function D(){return Math.pow(.95,u.zoomSpeed)}function R(e){f.theta-=e}function S(e){f.phi-=e}var k,C=(k=new e.Vector3,function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),g.add(k)}),Y=function(){var t=new e.Vector3;return function(e,n){!0===u.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(u.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),x=function(){var t=new e.Vector3;return function(e,n){var o=u.domElement;if(u.object.isPerspectiveCamera){var a=u.object.position;t.copy(a).sub(u.target);var i=t.length();i*=Math.tan(u.object.fov/2*Math.PI/180),C(2*e*i/o.clientHeight,u.object.matrix),Y(2*n*i/o.clientHeight,u.object.matrix)}else u.object.isOrthographicCamera?(C(e*(u.object.right-u.object.left)/u.object.zoom/o.clientWidth,u.object.matrix),Y(n*(u.object.top-u.object.bottom)/u.object.zoom/o.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),u.enablePan=!1)}}();function H(e){u.object.isPerspectiveCamera?O/=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom*e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function U(e){u.object.isPerspectiveCamera?O*=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom/e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function _(e){T.set(e.clientX,e.clientY)}function V(e){L.set(e.clientX,e.clientY)}function z(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,n)}}function I(e){if(1==e.touches.length)L.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);L.set(t,n)}}function X(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);N.set(0,o)}function F(e){if(1==e.touches.length)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var o=u.domElement;R(2*Math.PI*P.x/o.clientHeight),S(2*Math.PI*P.y/o.clientHeight),T.copy(y)}function Z(e){if(1==e.touches.length)w.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);w.set(t,n)}A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w)}function K(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);M.set(0,o),j.set(0,Math.pow(M.y/N.y,u.zoomSpeed)),H(j.y),N.copy(M)}function B(t){if(!1!==u.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var n;switch(t.preventDefault(),u.domElement.focus?u.domElement.focus():window.focus(),t.button){case 0:n=u.mouseButtons.LEFT;break;case 1:n=u.mouseButtons.MIDDLE;break;case 2:n=u.mouseButtons.RIGHT;break;default:n=-1}switch(n){case e.MOUSE.DOLLY:if(!1===u.enableZoom)return;!function(e){N.set(e.clientX,e.clientY)}(t),d=h.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enablePan)return;V(t),d=h.PAN}else{if(!1===u.enableRotate)return;_(t),d=h.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enableRotate)return;_(t),d=h.ROTATE}else{if(!1===u.enablePan)return;V(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(u.domElement.ownerDocument.addEventListener("pointermove",G),u.domElement.ownerDocument.addEventListener("pointerup",W),u.dispatchEvent(m))}(t)}}function G(e){if(!1!==u.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===u.enabled)return;switch(e.preventDefault(),d){case h.ROTATE:if(!1===u.enableRotate)return;!function(e){y.set(e.clientX,e.clientY),P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var t=u.domElement;R(2*Math.PI*P.x/t.clientHeight),S(2*Math.PI*P.y/t.clientHeight),T.copy(y),u.update()}(e);break;case h.DOLLY:if(!1===u.enableZoom)return;!function(e){M.set(e.clientX,e.clientY),j.subVectors(M,N),j.y>0?H(D()):j.y<0&&U(D()),N.copy(M),u.update()}(e);break;case h.PAN:if(!1===u.enablePan)return;!function(e){w.set(e.clientX,e.clientY),A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w),u.update()}(e)}}(e)}}function W(e){switch(e.pointerType){case"mouse":case"pen":!function(e){if(u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),!1===u.enabled)return;u.dispatchEvent(p),d=h.NONE}()}}function q(e){!1===u.enabled||!1===u.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),u.dispatchEvent(m),function(e){e.deltaY<0?U(D()):e.deltaY>0&&H(D()),u.update()}(e),u.dispatchEvent(p))}function Q(e){!1!==u.enabled&&!1!==u.enablePan&&function(e){var t=!1;switch(e.keyCode){case u.keys.UP:x(0,u.keyPanSpeed),t=!0;break;case u.keys.BOTTOM:x(0,-u.keyPanSpeed),t=!0;break;case u.keys.LEFT:x(u.keyPanSpeed,0),t=!0;break;case u.keys.RIGHT:x(-u.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),u.update())}(e)}function J(t){if(!1!==u.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(u.touches.ONE){case e.TOUCH.ROTATE:if(!1===u.enableRotate)return;z(t),d=h.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===u.enablePan)return;I(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(u.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&X(e),u.enablePan&&I(e)}(t),d=h.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&X(e),u.enableRotate&&z(e)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&u.dispatchEvent(m)}}function $(e){if(!1!==u.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===u.enableRotate)return;F(e),u.update();break;case h.TOUCH_PAN:if(!1===u.enablePan)return;Z(e),u.update();break;case h.TOUCH_DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&K(e),u.enablePan&&Z(e)}(e),u.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&K(e),u.enableRotate&&F(e)}(e),u.update();break;default:d=h.NONE}}function ee(e){!1!==u.enabled&&(u.dispatchEvent(p),d=h.NONE)}function te(e){!1!==u.enabled&&e.preventDefault()}u.domElement.addEventListener("contextmenu",te),u.domElement.addEventListener("pointerdown",B),u.domElement.addEventListener("wheel",q),u.domElement.addEventListener("touchstart",J),u.domElement.addEventListener("touchend",ee),u.domElement.addEventListener("touchmove",$),this.update()};exports.OrbitControls=t,t.prototype=Object.create(e.EventDispatcher.prototype),t.prototype.constructor=t;var n=function(n,o){t.call(this,n,o),this.screenSpacePanning=!1,this.mouseButtons.LEFT=e.MOUSE.PAN,this.mouseButtons.RIGHT=e.MOUSE.ROTATE,this.touches.ONE=e.TOUCH.PAN,this.touches.TWO=e.TOUCH.DOLLY_ROTATE};exports.MapControls=n,n.prototype=Object.create(e.EventDispatcher.prototype),n.prototype.constructor=n; },{"../../../build/three.module.js":"dKqR"}],"tuIt":[function(require,module,exports) { @@ -14,15 +14,15 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"IMAa":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=3||Math.abs(r-H)>=3){var a=3*(b.length/3-1),i=!1;if(b.length>3)P.set(b[a-3],b[a-3+1]),W.set(b[a],b[a+1]),W.sub(P).normalize(),P.set(b[a],b[a+1]),N.set(n,o),N.sub(P).normalize(),i=W.dot(N)>.99;i?(b[a]=n,b[a+1]=o):b.push(n,o,0),T=!0,h.visible=!0,D=t,H=r,x.liveUpdate&&(O=!0)}}}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function B(){if(p.update(),requestAnimationFrame(B),y.material.wireframe=x.wireframe,w.visible=x.displayHelper,T){if("lasso"===x.toolMode){var t=b.length;b.push(b[0],b[1],b[2]),h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1)),b.length=t}else h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1));h.frustumCulled=!1,T=!1}O&&(O=!1,b.length>0&&P());var r=Math.tan(e.MathUtils.DEG2RAD*s.fov/2)*h.position.z;h.scale.set(-r*s.aspect,-r,1),l.render(u,s),x.rotate&&(M.rotation.y+=.01,x.liveUpdate&&E&&(O=!0))}S(),B();var C=new e.Matrix4,R=new Array(8).fill().map(function(){return new e.Vector3}),A=new Array(12).fill().map(function(){return new e.Line3}),D=[],H=[];function P(){for(C.copy(y.matrixWorld).premultiply(s.matrixWorldInverse).premultiply(s.projectionMatrix);D.lengths&&(s=h.y),h.xs)||!(T>s))b0?1:2}function r(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)}for(var n=1/0,o=-1,a=0,i=e.length;a=r(l,e)?-1:1:2==o?-1:1})).length,c=1;cl&&d>s)return!1;if(du&&i>c)return!1;if(in.end.y,a=0,i=t.length;ad.end.y;N(e,d,o,l)&&r++,o=l}return r}function j(e,t){function r(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}var n=e.start,o=e.end,a=t.start,i=t.end;return r(n,a,i)!==r(o,a,i)&&r(n,o,a)!==r(n,o,i)} +"use strict";var e=d(require("three")),t=a(require("stats.js")),r=require("dat.gui"),n=require("three/examples/jsm/controls/OrbitControls.js"),o=require("../src/index.js");function a(e){return e&&e.__esModule?e:{default:e}}function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var d=o?Object.getOwnPropertyDescriptor(e,a):null;d&&(d.get||d.set)?Object.defineProperty(n,a,d):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}var l,s,u,c,p,f,h,y,w,v,m,g,M,x={toolMode:"lasso",selectionMode:"intersection",liveUpdate:!1,selectModel:!1,wireframe:!1,useBoundsTree:!0,displayHelper:!1,helperDepth:10,rotate:!0},b=[],E=!1,T=!1,O=!1;function S(){g=document.getElementById("output");var a=new e.Color(2503224);(l=new e.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),l.setSize(window.innerWidth,window.innerHeight),l.setClearColor(a,1),l.shadowMap.enabled=!0,l.gammaOutput=!0,document.body.appendChild(l.domElement),u=new e.Scene;var i=new e.DirectionalLight(16777215,1);i.castShadow=!0,i.shadow.mapSize.set(2048,2048),i.position.set(10,10,10),u.add(i),u.add(new e.AmbientLight(11583173,.8)),(s=new e.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(2,4,6),s.far=100,s.updateProjectionMatrix(),u.add(s),(h=new e.Line).material.color.set(16750592).convertSRGBToLinear(),h.renderOrder=1,h.position.z=-.2,h.depthTest=!1,h.scale.setScalar(1),s.add(h),M=new e.Group,u.add(M),(y=new e.Mesh(new e.TorusKnotBufferGeometry(1.5,.5,500,60).toNonIndexed(),new e.MeshStandardMaterial({polygonOffset:!0,polygonOffsetFactor:1}))).geometry.boundsTree=new o.MeshBVH(y.geometry,{lazyGeneration:!1}),y.geometry.setAttribute("color",new e.Uint8BufferAttribute(new Array(3*y.geometry.index.count).fill(255),3,!0)),y.castShadow=!0,y.receiveShadow=!0,M.add(y),w=new o.MeshBVHVisualizer(y,10),M.add(w),(v=new e.Mesh).geometry=y.geometry.clone(),v.geometry.drawRange.count=0,v.material=new e.MeshBasicMaterial({opacity:.05,transparent:!0,depthWrite:!1}),v.material.color.set(16750592).convertSRGBToLinear(),v.renderOrder=1,M.add(v),(m=new e.Mesh).geometry=v.geometry,m.material=new e.MeshBasicMaterial({opacity:.25,transparent:!0,wireframe:!0,depthWrite:!1}),m.material.color.copy(v.material.color),m.renderOrder=2,M.add(m);var d=new e.GridHelper(10,10,16777215,16777215);d.material.opacity=.2,d.material.transparent=!0,d.position.y=-2.75,u.add(d);var S=new e.Mesh(new e.PlaneBufferGeometry,new e.ShadowMaterial({color:0,opacity:.2,depthWrite:!1}));S.position.y=-2.74,S.rotation.x=-Math.PI/2,S.scale.setScalar(20),S.renderOrder=2,S.receiveShadow=!0,u.add(S),p=new t.default,document.body.appendChild(p.dom),(f=new n.OrbitControls(s,l.domElement)).minDistance=3,f.touches.ONE=e.TOUCH.PAN,f.mouseButtons.LEFT=e.MOUSE.PAN,f.touches.TWO=e.TOUCH.ROTATE,f.mouseButtons.RIGHT=e.MOUSE.ROTATE,f.enablePan=!1;var B=(c=new r.GUI).addFolder("selection");B.add(x,"toolMode",["lasso","box"]),B.add(x,"selectionMode",["centroid","intersection"]),B.add(x,"selectModel"),B.add(x,"liveUpdate"),B.add(x,"useBoundsTree"),B.open();var C=c.addFolder("display");C.add(x,"wireframe"),C.add(x,"rotate"),C.add(x,"displayHelper"),C.add(x,"helperDepth",1,30,1).onChange(function(e){w.depth=e,w.update()}),C.open(),c.open();var R=-1/0,A=-1/0,W=-1/0,D=-1/0,H=new e.Vector2,P=new e.Vector2,N=new e.Vector2;l.domElement.addEventListener("pointerdown",function(e){W=e.clientX,D=e.clientY,R=e.clientX/window.innerWidth*2-1,A=-(e.clientY/window.innerHeight*2-1),b.length=0,E=!0}),l.domElement.addEventListener("pointerup",function(){h.visible=!1,E=!1,b.length&&(O=!0)}),l.domElement.addEventListener("pointermove",function(e){if(0!=(1&e.buttons)){var t=e.clientX,r=e.clientY,n=e.clientX/window.innerWidth*2-1,o=-(e.clientY/window.innerHeight*2-1);if("box"===x.toolMode)b.length=15,b[0]=R,b[1]=A,b[2]=0,b[3]=n,b[4]=A,b[5]=0,b[6]=n,b[7]=o,b[8]=0,b[9]=R,b[10]=o,b[11]=0,b[12]=R,b[13]=A,b[14]=0,t===W&&r===D||(T=!0),W=t,D=r,h.visible=!0,x.liveUpdate&&(O=!0);else if(Math.abs(t-W)>=3||Math.abs(r-D)>=3){var a=3*(b.length/3-1),i=!1;if(b.length>3)H.set(b[a-3],b[a-3+1]),P.set(b[a],b[a+1]),P.sub(H).normalize(),H.set(b[a],b[a+1]),N.set(n,o),N.sub(H).normalize(),i=P.dot(N)>.99;i?(b[a]=n,b[a+1]=o):b.push(n,o,0),T=!0,h.visible=!0,W=t,D=r,x.liveUpdate&&(O=!0)}}}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function B(){if(p.update(),requestAnimationFrame(B),y.material.wireframe=x.wireframe,w.visible=x.displayHelper,T){if("lasso"===x.toolMode){var t=b.length;b.push(b[0],b[1],b[2]),h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1)),b.length=t}else h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1));h.frustumCulled=!1,T=!1}O&&(O=!1,b.length>0&&H());var r=Math.tan(e.MathUtils.DEG2RAD*s.fov/2)*h.position.z;h.scale.set(-r*s.aspect,-r,1),l.render(u,s),x.rotate&&(M.rotation.y+=.01,x.liveUpdate&&E&&(O=!0))}S(),B();var C=new e.Matrix4,R=new Array(8).fill().map(function(){return new e.Vector3}),A=new Array(12).fill().map(function(){return new e.Line3}),W=[],D=[];function H(){for(C.copy(y.matrixWorld).premultiply(s.matrixWorldInverse).premultiply(s.projectionMatrix);W.lengths&&(s=h.y),h.xs)||!(T>s))b0?1:2}function r(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)}for(var n=1/0,o=-1,a=0,i=e.length;a=r(l,e)?-1:1:2==o?-1:1})).length,c=1;cl&&d>s)return!1;if(du&&i>c)return!1;if(in.end.y,a=0,i=t.length;ad.end.y;N(e,d,o,l)&&r++,o=l}return r}function j(e,t){function r(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}var n=e.start,o=e.end,a=t.start,i=t.end;return r(n,a,i)!==r(o,a,i)&&r(n,o,a)!==r(n,o,i)} },{"three":"dKqR","stats.js":"dnrf","dat.gui":"KkZG","three/examples/jsm/controls/OrbitControls.js":"xTGv","../src/index.js":"uBxZ"}]},{},["jNWJ"], null) \ No newline at end of file diff --git a/example/bundle/shapecast.b93a7fe2.js b/example/bundle/shapecast.b93a7fe2.js index 7947e04eb..e1f1de9c4 100644 --- a/example/bundle/shapecast.b93a7fe2.js +++ b/example/bundle/shapecast.b93a7fe2.js @@ -2,7 +2,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel var e=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e); },{}],"ss9A":[function(require,module,exports) { -var e=module.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e); +var e=module.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e); },{}],"M7z6":[function(require,module,exports) { module.exports=function(o){return"object"==typeof o?null!==o:"function"==typeof o}; },{}],"eT53":[function(require,module,exports) { @@ -31,7 +31,7 @@ var o=0,t=Math.random();module.exports=function(n){return"Symbol(".concat(void 0 module.exports=!1; },{}],"zGcK":[function(require,module,exports) { -var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"}); +var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"}); },{"./_core":"ss9A","./_global":"qf4T","./_library":"H21C"}],"d5RU":[function(require,module,exports) { module.exports=require("./_shared")("native-function-to-string",Function.toString); },{"./_shared":"zGcK"}],"PHot":[function(require,module,exports) { @@ -78,7 +78,11 @@ var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("spec var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)}; },{"./_array-species-constructor":"NNbH"}],"AuPh":[function(require,module,exports) { var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; -},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { +},{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Hh2M":[function(require,module,exports) { +"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; +},{"./_fails":"BXiR"}],"GyG6":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(2);r(r.P+r.F*!require("./_strict-method")([].filter,!0),"Array",{filter:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"Qppk":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); },{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); @@ -134,20 +138,20 @@ var t=require("./_has"),e=require("./_to-object"),o=require("./_shared-key")("IE "use strict";var e=require("./_library"),r=require("./_export"),t=require("./_redefine"),i=require("./_hide"),n=require("./_iterators"),u=require("./_iter-create"),o=require("./_set-to-string-tag"),s=require("./_object-gpo"),a=require("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",l="keys",q="values",y=function(){return this};module.exports=function(_,p,h,k,v,w,d){u(h,p,k);var x,b,g,j=function(e){if(!c&&e in I)return I[e];switch(e){case l:case q:return function(){return new h(this,e)}}return function(){return new h(this,e)}},m=p+" Iterator",A=v==q,F=!1,I=_.prototype,O=I[a]||I[f]||v&&I[v],P=O||j(v),z=v?A?j("entries"):P:void 0,B="Array"==p&&I.entries||O;if(B&&(g=s(B.call(new _)))!==Object.prototype&&g.next&&(o(g,m,!0),e||"function"==typeof g[a]||i(g,a,y)),A&&O&&O.name!==q&&(F=!0,P=function(){return O.call(this)}),e&&!d||!c&&!F&&I[a]||i(I,a,P),n[p]=P,n[m]=y,v)if(x={values:A?P:j(q),keys:w?P:j(l),entries:z},d)for(b in x)b in I||t(I,b,x[b]);else r(r.P+r.F*(c||F),p,x);return x}; },{"./_library":"H21C","./_export":"izCb","./_redefine":"PHot","./_hide":"NXbe","./_iterators":"JO4d","./_iter-create":"ebgP","./_set-to-string-tag":"rq3q","./_object-gpo":"q6yw","./_wks":"AIP1"}],"wVEN":[function(require,module,exports) { "use strict";var e=require("./_add-to-unscopables"),r=require("./_iter-step"),t=require("./_iterators"),i=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=i(e),this._i=0,this._k=r},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])},"values"),t.Arguments=t.Array,e("keys"),e("values"),e("entries"); -},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RB6b":[function(require,module,exports) { +},{"./_add-to-unscopables":"Z7eD","./_iter-step":"x8b3","./_iterators":"JO4d","./_to-iobject":"g6sb","./_iter-define":"mH0U"}],"RBsu":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_array-methods")(1);r(r.P+r.F*!require("./_strict-method")([].map,!0),"Array",{map:function(r){return e(this,r,arguments[1])}}); +},{"./_export":"izCb","./_array-methods":"AuPh","./_strict-method":"Hh2M"}],"RB6b":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_create-property");r(r.S+r.F*require("./_fails")(function(){function r(){}return!(Array.of.call(r)instanceof r)}),"Array",{of:function(){for(var r=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>r;)e(n,r,arguments[r++]);return n.length=t,n}}); -},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"Hh2M":[function(require,module,exports) { -"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})}; -},{"./_fails":"BXiR"}],"nrVf":[function(require,module,exports) { +},{"./_export":"izCb","./_create-property":"JCwR","./_fails":"BXiR"}],"btFn":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_html"),i=require("./_cof"),t=require("./_to-absolute-index"),u=require("./_to-length"),a=[].slice;r(r.P+r.F*require("./_fails")(function(){e&&a.call(e)}),"Array",{slice:function(r,e){var l=u(this.length),n=i(this);if(e=void 0===e?l:e,"Array"==n)return a.call(this,r,e);for(var s=t(r,l),c=t(e,l),h=u(c-s),o=new Array(h),f=0;f=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)} -},{}],"dnrf":[function(require,module,exports) { +},{"./es6.array.iterator":"wVEN","./_object-keys":"U9a7","./_redefine":"PHot","./_global":"qf4T","./_hide":"NXbe","./_iterators":"JO4d","./_wks":"AIP1"}],"dnrf":[function(require,module,exports) { var define; var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof e&&e.amd?e(n):t.Stats=n()}(this,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;to+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var l=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,s=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,s,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p,u,s,m),{dom:h,update:function(f,y){l=Math.min(l,f),i=Math.max(i,f),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(a(f)+" "+e+" ("+a(l)+"-"+a(i)+")",c,d),v.drawImage(h,p+o,u,s-o,m,p,u,s-o,m),v.fillRect(p+s-o,u,o,m),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(p+s-o,u,o,a((1-f/y)*m))}}},e}); },{}],"KkZG":[function(require,module,exports) { -"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),D(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,D(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),j=["-moz-","-o-","-webkit-","-ms-",""];function D(e,t,n,o){e.style.background="",i.each(j,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; +"use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae; },{}],"dKqR":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArrayCamera=ch,exports.AxisHelper=lx,exports.BinaryTextureLoader=dx,exports.Bone=Yh,exports.BoundingBoxHelper=cx,exports.BufferAttribute=bi,exports.BufferGeometry=ki,exports.Camera=gs,exports.CanvasRenderer=fx,exports.CompressedTextureLoader=md,exports.CubicInterpolant=Xp,exports.Curve=yd,exports.DataTextureLoader=xd,exports.DiscreteInterpolant=Zp,exports.DynamicBufferAttribute=Kg,exports.EdgesHelper=hx,exports.EventDispatcher=In,exports.FileLoader=pd,exports.Float16BufferAttribute=Ri,exports.Float32Attribute=ox,exports.Float32BufferAttribute=Ci,exports.Float64Attribute=ax,exports.Float64BufferAttribute=Pi,exports.GLBufferAttribute=xf,exports.ImageBitmapLoader=Sm,exports.ImmediateRenderObject=Lf,exports.InstancedBufferAttribute=vm,exports.InstancedBufferGeometry=xm,exports.InstancedInterleavedBuffer=gf,exports.InstancedMesh=nu,exports.Int16Attribute=nx,exports.Int16BufferAttribute=Ti,exports.Int32Attribute=ix,exports.Int32BufferAttribute=Ai,exports.Int8Attribute=$g,exports.Int8BufferAttribute=wi,exports.InterleavedBuffer=_h,exports.InterleavedBufferAttribute=wh,exports.Interpolant=qp,exports.JSONLoader=gx,exports.LensFlare=vx,exports.Line=cu,exports.LineSegments=pu,exports.LinearInterpolant=Yp,exports.Loader=hd,exports.LoadingManager=ld,exports.Material=hi,exports.Mesh=os,exports.MeshFaceMaterial=Vg,exports.MeshPhysicalMaterial=Op,exports.MeshStandardMaterial=Fp,exports.MultiMaterial=Wg,exports.Object3D=Xr,exports.ParametricGeometry=exports.ParametricBufferGeometry=wp,exports.Particle=qg,exports.ParticleBasicMaterial=Zg,exports.ParticleSystem=Xg,exports.ParticleSystemMaterial=Jg,exports.PerspectiveCamera=xs,exports.PointCloud=jg,exports.PointCloudMaterial=Yg,exports.Points=yu,exports.PropertyBinding=uf,exports.QuaternionLinearInterpolant=td,exports.Raycaster=vf,exports.ShaderMaterial=fs,exports.SkinnedMesh=Xh,exports.TextureLoader=vd,exports.Uint16Attribute=rx,exports.Uint16BufferAttribute=Ei,exports.Uint32Attribute=sx,exports.Uint32BufferAttribute=Li,exports.Uint8Attribute=tx,exports.Uint8BufferAttribute=Mi,exports.Uint8ClampedAttribute=ex,exports.Uint8ClampedBufferAttribute=Si,exports.Vertex=Qg,exports.WebGLRenderTargetCube=mx,exports.WebGLRenderer=fh,exports.WebGLUtils=lh,exports.WireframeHelper=ux,exports.XHRLoader=px,exports.FloatType=exports.FlatShading=exports.FaceColors=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTexture=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CanvasTexture=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.ObjectLoader=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MaterialLoader=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.ImageLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.FontLoader=exports.Font=exports.FogExp2=exports.Fog=void 0,exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.Path=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VertexColors=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.Texture=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=void 0;const t="126";exports.REVISION="126";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const r=0;exports.CullFaceNone=r;const i=1;exports.CullFaceBack=i;const s=2;exports.CullFaceFront=s;const o=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const l=1;exports.PCFShadowMap=l;const c=2;exports.PCFSoftShadowMap=c;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const m=1;exports.FlatShading=1;const f=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const I=206;exports.DstAlphaFactor=I;const B=207;exports.OneMinusDstAlphaFactor=B;const N=208;exports.DstColorFactor=N;const F=209;exports.OneMinusDstColorFactor=F;const O=210;exports.SrcAlphaSaturateFactor=O;const z=0;exports.NeverDepth=z;const G=1;exports.AlwaysDepth=G;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=et;const nt=301;exports.CubeReflectionMapping=nt;const rt=302;exports.CubeRefractionMapping=rt;const it=303;exports.EquirectangularReflectionMapping=it;const st=304;exports.EquirectangularRefractionMapping=st;const ot=306;exports.CubeUVReflectionMapping=ot;const at=307;exports.CubeUVRefractionMapping=at;const lt=1e3;exports.RepeatWrapping=lt;const ct=1001;exports.ClampToEdgeWrapping=ct;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const mt=1005;exports.NearestMipmapLinearFilter=mt;const ft=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const It=1021;exports.AlphaFormat=It;const Bt=1022;exports.RGBFormat=Bt;const Nt=1023;exports.RGBAFormat=Nt;const Ft=1024;exports.LuminanceFormat=Ft;const Ot=1025;exports.LuminanceAlphaFormat=Ot;const zt=Nt;exports.RGBEFormat=zt;const Gt=1026;exports.DepthFormat=Gt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const re=37496;exports.RGBA_ETC2_EAC_Format=re;const ie=37808;exports.RGBA_ASTC_4x4_Format=ie;const se=37809;exports.RGBA_ASTC_5x4_Format=se;const oe=37810;exports.RGBA_ASTC_5x5_Format=oe;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const le=37812;exports.RGBA_ASTC_6x6_Format=le;const ce=37813;exports.RGBA_ASTC_8x5_Format=ce;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const me=37818;exports.RGBA_ASTC_10x8_Format=me;const fe=37819;exports.RGBA_ASTC_10x10_Format=fe;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Ie=2200;exports.LoopOnce=Ie;const Be=2201;exports.LoopRepeat=Be;const Ne=2202;exports.LoopPingPong=Ne;const Fe=2300;exports.InterpolateDiscrete=Fe;const Oe=2301;exports.InterpolateLinear=Oe;const ze=2302;exports.InterpolateSmooth=ze;const Ge=2400;exports.ZeroCurvatureEnding=Ge;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const sn=1;exports.ObjectSpaceNormalMap=sn;const on=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const ln=7681;exports.ReplaceStencilOp=7681;const cn=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const mn=512;exports.NeverStencilFunc=512;const fn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function In(){}exports.GLSL3=Dn,Object.assign(In.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e>8&255]+Bn[t>>16&255]+Bn[t>>24&255]+"-"+Bn[255&e]+Bn[e>>8&255]+"-"+Bn[e>>16&15|64]+Bn[e>>24&255]+"-"+Bn[63&n|128]+Bn[n>>8&255]+"-"+Bn[n>>16&255]+Bn[n>>24&255]+Bn[255&r]+Bn[r>>8&255]+Bn[r>>16&255]+Bn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Fn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Fn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Nn=t%2147483647),((Nn=16807*Nn%2147483647)-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),h=o((e+r)/2),u=s((e-r)/2),p=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(i){case"XYX":t.set(a*h,l*u,l*p,a*c);break;case"YZY":t.set(l*p,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*p,a*h,a*c);break;case"XZX":t.set(a*h,l*m,l*d,a*c);break;case"YXY":t.set(l*d,a*h,l*m,a*c);break;case"ZYZ":t.set(l*m,l*d,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};exports.MathUtils=exports.Math=Fn;class On{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=On,On.prototype.isVector2=!0;class zn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],m=r[0],f=r[3],g=r[6],x=r[1],v=r[4],y=r[7],_=r[2],b=r[5],w=r[8];return i[0]=s*m+o*x+a*_,i[3]=s*f+o*v+a*b,i[6]=s*g+o*y+a*w,i[1]=l*m+c*x+h*_,i[4]=l*f+c*v+h*b,i[7]=l*g+c*y+h*w,i[2]=u*m+p*x+d*_,i[5]=u*f+p*v+d*b,i[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*i*c+n*o*a+r*i*l-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*i,p=l*i-s*a,d=e*h+n*u+r*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=h*m,t[1]=(r*l-c*n)*m,t[2]=(o*n-r*s)*m,t[3]=u*m,t[4]=(c*e-r*a)*m,t[5]=(r*i-o*e)*m,t[6]=p*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*i)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,s,o){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-r*l,r*a,-r*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],l=r[4],c=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*a,r[4]=-n*s+e*l,r[7]=-n*o+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;exports.Matrix3=zn,zn.prototype.isMatrix3=!0;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;class kn extends In{constructor(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=ct,r=ct,i=gt,s=yt,o=Nt,a=bt,l=1,c=Xe){super(),Object.defineProperty(this,"id",{value:Un++}),this.uuid=Fn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new On(0,0),this.repeat=new On(1,1),this.center=new On(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=Fn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t1)switch(this.wrapS){case lt:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case lt:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}exports.Texture=kn,kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=et,kn.prototype.isTexture=!0;class Wn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const s=t.elements,o=s[0],a=s[4],l=s[8],c=s[1],h=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(h+1)/2,f=(m+1)/2,g=(a+c)/4,x=(l+p)/4,v=(u+d)/4;return t>s&&t>f?t<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(t)),i=x/n):s>f?s<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(s)),i=v/r):f<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(f)),r=v/i),this.set(n,r,i,e),this}let f=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-a)*(c-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(l-p)/f,this.z=(c-a)/f,this.w=Math.acos((o+h+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn,Wn.prototype.isVector4=!0;class jn extends In{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn,jn.prototype.isWebGLRenderTarget=!0;class qn extends jn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn,qn.prototype.isWebGLMultisampleRenderTarget=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[s+0],p=i[s+1],d=i[s+2],m=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(h!==m||a!==u||l!==p||c!==d){let t=1-o;const e=a*u+l*p+c*d+h*m,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+u*i,l=l*t+p*i,c=c*t+d*i,h=h*t+m*i,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[s],u=i[s+1],p=i[s+2],d=i[s+3];return t[e]=o*d+c*h+a*p-l*u,t[e+1]=a*d+c*u+l*h-o*p,t[e+2]=l*d+c*p+o*u-a*h,t[e+3]=c*d-o*h-a*u-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=a(n/2),p=a(r/2),d=a(i/2);switch(s){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(i-l)*t,this._z=(s-r)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(i-l)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-r)/t,this._x=(i+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+r*l-i*a,this._y=r*c+s*a+i*o-n*l,this._z=i*c+s*l+n*a-r*o,this._w=s*c-n*o-r*a-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn,Xn.prototype.isQuaternion=!0;class Yn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*r-o*n,c=a*n+o*e-i*r,h=a*r+i*n-s*e,u=-i*e-s*n-o*r;return this.x=l*a+u*-i+c*-o-h*-s,this.y=c*a+u*-s+h*-i-l*-o,this.z=h*a+u*-o+l*-s-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn,Yn.prototype.isVector3=!0;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t=new Yn(1/0,1/0,1/0),e=new Yn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;ai&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$n),$n.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ar),lr.subVectors(this.max,ar),er.subVectors(t.a,ar),nr.subVectors(t.b,ar),rr.subVectors(t.c,ar),ir.subVectors(nr,er),sr.subVectors(rr,nr),or.subVectors(er,rr);let e=[0,-ir.z,ir.y,0,-sr.z,sr.y,0,-or.z,or.y,ir.z,0,-ir.x,sr.z,0,-sr.x,or.z,0,-or.x,-ir.y,ir.x,0,-sr.y,sr.x,0,-or.y,or.x,0];return!!ur(e,er,nr,rr,lr)&&(!!ur(e=[1,0,0,0,1,0,0,0,1],er,nr,rr,lr)&&(cr.crossVectors(ir,sr),ur(e=[cr.x,cr.y,cr.z],er,nr,rr,lr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $n.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize($n).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box3=Qn,Qn.prototype.isBox3=!0;const Kn=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],$n=new Yn,tr=new Qn,er=new Yn,nr=new Yn,rr=new Yn,ir=new Yn,sr=new Yn,or=new Yn,ar=new Yn,lr=new Yn,cr=new Yn,hr=new Yn;function ur(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){hr.fromArray(t,s);const o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),a=e.dot(hr),l=n.dot(hr),c=r.dot(hr);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const pr=new Qn;class dr{constructor(t=new Yn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}exports.Sphere=dr;const mr=new Yn,fr=new Yn,gr=new Yn,xr=new Yn,vr=new Yn,yr=new Yn,_r=new Yn;class br{constructor(t=new Yn,e=new Yn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mr.copy(this.direction).multiplyScalar(e).add(this.origin),mr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){fr.copy(t).add(e).multiplyScalar(.5),gr.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(fr);const i=.5*t.distanceTo(e),s=-this.direction.dot(gr),o=xr.dot(this.direction),a=-xr.dot(gr),l=xr.lengthSq(),c=Math.abs(1-s*s);let h,u,p,d;if(c>0)if(u=s*o-a,d=i*c,(h=s*a-o)>=0)if(u>=-d)if(u<=d){const t=1/c;p=(h*=t)*(h+s*(u*=t)+2*o)+u*(s*h+u+2*a)+l}else u=i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u=-i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u<=-d?p=-(h=Math.max(0,-(-s*i+o)))*h+(u=h>0?-i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l:u<=d?(h=0,p=(u=Math.min(Math.max(-i,-a),i))*(u+2*a)+l):p=-(h=Math.max(0,-(s*i+o)))*h+(u=h>0?i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l;else u=s>0?-i:i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(gr).multiplyScalar(u).add(fr),p}intersectSphere(t,e){mr.subVectors(t.center,this.origin);const n=mr.dot(this.direction),r=mr.dot(mr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,r=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,r=(t.min.x-u.x)*l),c>=0?(i=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(i=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||i>r?null:((i>n||n!=n)&&(n=i),(s=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>r?null:((o>n||n!=n)&&(n=o),(a=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mr)}intersectTriangle(t,e,n,r,i){vr.subVectors(e,t),yr.subVectors(n,t),_r.crossVectors(vr,yr);let s,o=this.direction.dot(_r);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}xr.subVectors(this.origin,t);const a=s*this.direction.dot(yr.crossVectors(xr,yr));if(a<0)return null;const l=s*this.direction.dot(vr.cross(xr));if(l<0)return null;if(a+l>o)return null;const c=-s*xr.dot(_r);return c<0?null:this.at(c/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}exports.Ray=br;class wr{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,l,c,h,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wr).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Mr.setFromMatrixColumn(t,0).length(),i=1/Mr.setFromMatrixColumn(t,1).length(),s=1/Mr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-o*a,e[2]=i-t*l,e[6]=r+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t-i*o,e[4]=-s*h,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*c,e[9]=i-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=a*h,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=i-t*h,e[8]=r*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+r,e[10]=t-i*h}else if("XZY"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+i,e[5]=s*c,e[9]=n*h-r,e[2]=r*h-n,e[6]=o*c,e[10]=i*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tr,t,Er)}lookAt(t,e,n){const r=this.elements;return Rr.subVectors(t,e),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ar.crossVectors(n,Rr),0===Ar.lengthSq()&&(1===Math.abs(n.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ar.crossVectors(n,Rr)),Ar.normalize(),Lr.crossVectors(Rr,Ar),r[0]=Ar.x,r[4]=Lr.x,r[8]=Rr.x,r[1]=Ar.y,r[5]=Lr.y,r[9]=Rr.y,r[2]=Ar.z,r[6]=Lr.z,r[10]=Rr.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],m=n[6],f=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],B=r[7],N=r[11],F=r[15];return i[0]=s*b+o*T+a*R+l*I,i[4]=s*w+o*E+a*C+l*B,i[8]=s*M+o*A+a*P+l*N,i[12]=s*S+o*L+a*D+l*F,i[1]=c*b+h*T+u*R+p*I,i[5]=c*w+h*E+u*C+p*B,i[9]=c*M+h*A+u*P+p*N,i[13]=c*S+h*L+u*D+p*F,i[2]=d*b+m*T+f*R+g*I,i[6]=d*w+m*E+f*C+g*B,i[10]=d*M+m*A+f*P+g*N,i[14]=d*S+m*L+f*D+g*F,i[3]=x*b+v*T+y*R+_*I,i[7]=x*w+v*E+y*C+_*B,i[11]=x*M+v*A+y*P+_*N,i[15]=x*S+v*L+y*D+_*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+i*a*h-r*l*h-i*o*u+n*l*u+r*o*p-n*a*p)+t[7]*(+e*a*p-e*l*u+i*s*u-r*s*p+r*l*c-i*a*c)+t[11]*(+e*l*h-e*o*p-i*s*h+n*s*p+i*o*c-n*l*c)+t[15]*(-r*o*c-e*a*h+e*o*u+r*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e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getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,l=i*s,c=i*o;return this.set(l*s+n,l*o-r*a,l*a+r*o,0,l*o+r*a,c*o+n,c*a-r*s,0,l*a-r*o,c*a+r*s,i*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,l=i+i,c=s+s,h=o+o,u=i*l,p=i*c,d=i*h,m=s*c,f=s*h,g=o*h,x=a*l,v=a*c,y=a*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(m+g))*_,r[1]=(p+y)*_,r[2]=(d-v)*_,r[3]=0,r[4]=(p-y)*b,r[5]=(1-(u+g))*b,r[6]=(f+x)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(f-x)*w,r[10]=(1-(u+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Mr.set(r[0],r[1],r[2]).length();const s=Mr.set(r[4],r[5],r[6]).length(),o=Mr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Sr.copy(this);const a=1/i,l=1/s,c=1/o;return Sr.elements[0]*=a,Sr.elements[1]*=a,Sr.elements[2]*=a,Sr.elements[4]*=l,Sr.elements[5]*=l,Sr.elements[6]*=l,Sr.elements[8]*=c,Sr.elements[9]*=c,Sr.elements[10]*=c,e.setFromRotationMatrix(Sr),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),h=(n+r)/(n-r),u=-(s+i)/(s-i),p=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),l=1/(n-r),c=1/(s-i),h=(e+t)*a,u=(n+r)*l,p=(s+i)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wr,wr.prototype.isMatrix4=!0;const Mr=new Yn,Sr=new wr,Tr=new Yn(0,0,0),Er=new Yn(1,1,1),Ar=new Yn,Lr=new Yn,Rr=new Yn,Cr=new wr,Pr=new Xn;class Dr{constructor(t=0,e=0,n=0,r=Dr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Fn.clamp,i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Pr.setFromEuler(this),this.setFromQuaternion(Pr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Dr,Dr.prototype.isEuler=!0,Dr.DefaultOrder="XYZ",Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ir{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){r.children=[];for(let e=0;e0){r.animations=[];for(let e=0;e0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function s(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n1?void 0:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Jr.getNormalMatrix(t),r=this.coplanarPoint(Yr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}exports.Plane=Qr,Qr.prototype.isPlane=!0;const Kr=new Yn,$r=new Yn,ti=new Yn,ei=new Yn,ni=new Yn,ri=new Yn,ii=new Yn,si=new Yn,oi=new Yn,ai=new Yn;class li{constructor(t=new Yn,e=new Yn,n=new Yn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Yn),r.subVectors(n,e),Kr.subVectors(t,e),r.cross(Kr);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Kr.subVectors(r,e),$r.subVectors(n,e),ti.subVectors(t,e);const s=Kr.dot(Kr),o=Kr.dot($r),a=Kr.dot(ti),l=$r.dot($r),c=$r.dot(ti),h=s*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Yn),0===h)return i.set(-2,-1,-1);const u=1/h,p=(l*a-o*c)*u,d=(s*c-o*a)*u;return i.set(1-p-d,d,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ei),a.set(0,0),a.addScaledVector(i,ei.x),a.addScaledVector(s,ei.y),a.addScaledVector(o,ei.z),a}static isFrontFacing(t,e,n,r){return Kr.subVectors(n,e),$r.subVectors(t,e),Kr.cross($r).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Kr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Kr.cross($r).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return li.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qr),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return li.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return li.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return li.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return li.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,r=this.b,i=this.c;let s,o;ni.subVectors(r,n),ri.subVectors(i,n),si.subVectors(t,n);const a=ni.dot(si),l=ri.dot(si);if(a<=0&&l<=0)return e.copy(n);oi.subVectors(t,r);const c=ni.dot(oi),h=ri.dot(oi);if(c>=0&&h<=c)return e.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(ni,s);ai.subVectors(t,i);const p=ni.dot(ai),d=ri.dot(ai);if(d>=0&&p<=d)return e.copy(i);const m=p*l-a*d;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),e.copy(n).addScaledVector(ri,o);const f=c*d-p*h;if(f<=0&&h-c>=0&&p-d>=0)return ii.subVectors(i,r),o=(h-c)/(h-c+(p-d)),e.copy(r).addScaledVector(ii,o);const g=1/(f+m+u);return s=m*g,o=u*g,e.copy(n).addScaledVector(ni,s).addScaledVector(ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=li;let ci=0;function hi(){Object.defineProperty(this,"id",{value:ci++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}hi.prototype=Object.assign(Object.create(In.prototype),{constructor:hi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(hi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},di={h:0,s:0,l:0};function mi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function fi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=mi(i,r,t+1/3),this.g=mi(i,r,t),this.b=mi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ui[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}copyLinearToSRGB(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const l=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=l<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(ne&&(e=t[n]);return e}Object.defineProperty(bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r65535?Li:Ei)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new zn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fi.makeRotationX(t),this.applyMatrix4(Fi),this},rotateY:function(t){return Fi.makeRotationY(t),this.applyMatrix4(Fi),this},rotateZ:function(t){return Fi.makeRotationZ(t),this.applyMatrix4(Fi),this},translate:function(t,e,n){return Fi.makeTranslation(t,e,n),this.applyMatrix4(Fi),this},scale:function(t,e,n){return Fi.makeScale(t,e,n),this.applyMatrix4(Fi),this},lookAt:function(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],r=e.toJSON(t.data);""!==e.name&&(r.name=e.name),t.data.attributes[a]=r}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ki).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const l in r){const t=r[l];this.setAttribute(l,t.clone(e))}const i=t.morphAttributes;for(const l in i){const t=[],n=i[l];for(let r=0,i=n.length;rn.far?null:{distance:c,point:ss.clone(),object:t}}function ls(t,e,n,r,i,s,o,a,l,c,h,u){qi.fromBufferAttribute(i,c),Xi.fromBufferAttribute(i,h),Yi.fromBufferAttribute(i,u);const p=t.morphTargetInfluences;if(e.morphTargets&&s&&p){Ki.set(0,0,0),$i.set(0,0,0),ts.set(0,0,0);for(let t=0,e=s.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(i),!1===t.ray.intersectsSphere(ji))return;if(Vi.copy(i).invert(),Wi.copy(t.ray).applyMatrix4(Vi),null!==n.boundingBox&&!1===Wi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;n0?1:-1,c.push(A.x,A.y,A.z),h.push(a/f),h.push(1-o/g),T+=1}}for(let o=0;o0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},gs.prototype=Object.assign(Object.create(Xr.prototype),{constructor:gs,isCamera:!0,copy:function(t,e){return Xr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),xs.prototype=Object.assign(Object.create(gs.prototype),{constructor:xs,isPerspectiveCamera:!0,copy:function(t,e){return gs.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xr.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const vs=90,ys=1;class _s extends Xr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new xs(vs,ys,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(1,0,0)),this.add(r);const i=new xs(vs,ys,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(-1,0,0)),this.add(i);const s=new xs(vs,ys,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Yn(0,1,0)),this.add(s);const o=new xs(vs,ys,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Yn(0,-1,0)),this.add(o);const a=new xs(vs,ys,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const l=new xs(vs,ys,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Yn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}exports.CubeCamera=_s;class bs extends kn{constructor(t,e,n,r,i,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:nt,n,r,i,s,o=void 0!==o?o:Bt,a,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}exports.CubeTexture=bs,bs.prototype.isCubeTexture=!0;class ws extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bs(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:gt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Nt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new cs(5,5,5),i=new fs({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});i.uniforms.tEquirect.value=e;const s=new os(r,i),o=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new _s(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}exports.WebGLCubeRenderTarget=ws,ws.prototype.isWebGLCubeRenderTarget=!0;class Ms extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ut,this.minFilter=void 0!==c?c:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}exports.DataTexture=Ms,Ms.prototype.isDataTexture=!0;const Ss=new dr,Ts=new Yn;class Es{constructor(t=new Qr,e=new Qr,n=new Qr,r=new Qr,i=new Qr,s=new Qr){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],m=n[11],f=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(o-r,h-a,m-u,v-f).normalize(),e[1].setComponents(o+r,h+a,m+u,v+f).normalize(),e[2].setComponents(o+i,h+l,m+p,v+g).normalize(),e[3].setComponents(o-i,h-l,m-p,v-g).normalize(),e[4].setComponents(o-s,h-c,m-d,v-x).normalize(),e[5].setComponents(o+s,h+c,m+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version=0){const s=l[e];if(void 0!==s){const e=s.normalized,i=s.itemSize,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(f(r,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r+0,1),f(r+1,1),f(r+2,1),f(r+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r+0,4,o,!1,64,0),t.vertexAttribPointer(r+1,4,o,!1,64,16),t.vertexAttribPointer(r+2,4,o,!1,64,32),t.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)u(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function rl(t,e,n,r){const i=r.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,r){t.drawArrays(s,e,r),n.update(r,s,1)},this.renderInstances=function(r,o,a){if(0===a)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,r,o,a),n.update(o,s,a)}}function il(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=s||e.has("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:s?t.getParameter(36183):0}}function sl(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Qr,a=new zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==i||null===c){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length0){const o=t.getRenderTarget(),a=new ws(s.height/2);return a.fromEquirectangularTexture(t,i),e.set(i,a),t.setRenderTarget(o),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function al(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ll(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e65535?Li:Ei)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===i[e.id]?e:(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n0)return t;const i=e*n;let s=bl[i];if(void 0===s&&(s=new Float32Array(i),bl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function Al(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n/gm;function Rc(t){return t.replace(Lc,Cc)}function Cc(t,e){const n=Ka[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Pc=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Dc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ic(t){return t.replace(Dc,Nc).replace(Pc,Bc)}function Bc(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nc(t,e,n,r)}function Nc(t,e,n,r){let i="";for(let s=parseInt(e);s0?t.gammaFactor:1,d=n.isWebGL2?"":wc(n),m=Mc(s),f=i.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[m].filter(Tc).join("\n")).length>0&&(g+="\n"),(x=[d,m].filter(Tc).join("\n")).length>0&&(x+="\n")):(g=[Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Tc).join("\n"),x=[d,Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?Ka.tonemapping_pars_fragment:"",n.toneMapping!==Z?bc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ka.encodings_pars_fragment,n.map?yc("mapTexelToLinear",n.mapEncoding):"",n.matcap?yc("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?yc("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?yc("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?yc("lightMapTexelToLinear",n.lightMapEncoding):"",_c("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Tc).join("\n")),o=Ac(o=Ec(o=Rc(o),n),n),a=Ac(a=Ec(a=Rc(a),n),n),o=Ic(o),a=Ic(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const y=v+x+a,_=mc(i,35633,v+g+o),b=mc(i,35632,y);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(f).trim(),e=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const e=vc(i,_,"vertex"),n=vc(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new dc(i,f)),w},this.getAttributes=function(){return void 0===M&&(M=Sc(i,f)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=fc++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}function kc(t,e,n,r,i,s){const o=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let m=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(i,o,g,v,y){const _=v.fog,b=i.isMeshStandardMaterial?v.environment:null,w=e.get(i.envMap||b),M=f[i.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===d,flipSided:i.side===p,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&r.sort(t||Wc),i.length>1&&i.sort(e||jc)}}}function Xc(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new qc(t),e.set(n,[i])):r>=e.get(n).length?(i=new qc(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new xi};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Zc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Jc=0;function Qc(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Kc(t,e){const n=new Yc,r=Zc(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)i.probe.push(new Yn);const s=new Yn,o=new wr,a=new wr;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,h=0,u=0,p=0,d=0,m=0,f=0,g=0;s.sort(Qc);for(let t=0,e=s.length;t0&&(e.isWebGL2?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=$a.LTC_HALF_1,i.rectAreaLTC2=$a.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=a,i.ambient[2]=l;const x=i.hash;x.directionalLength===c&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===m&&x.numPointShadows===f&&x.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=p,i.point.length=h,i.hemi.length=d,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=f,i.spotShadowMatrix.length=g,x.directionalLength=c,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=m,x.numPointShadows=f,x.numSpotShadows=g,i.version=Jc++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p=n.get(r).length?(s=new $c(t,e),n.get(r).push(s)):s=n.get(r)[i],s},dispose:function(){n=new WeakMap}}}class eh extends hi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}exports.MeshDepthMaterial=eh,eh.prototype.isMeshDepthMaterial=!0;class nh extends hi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}exports.MeshDistanceMaterial=nh,nh.prototype.isMeshDistanceMaterial=!0;var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ih="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let r=new Es;const i=new On,s=new On,o=new Wn,a=[],c=[],m={},f={0:p,1:u,2:d},x=new fs({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new On},radius:{value:4}},vertexShader:ih,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new ki;y.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new os(y,x),b=this;function w(n,r){const i=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,_,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=a[r];return void 0===i&&(i=new eh({depthPacking:nn,morphTargets:t,skinning:e}),a[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=c[r];return void 0===i&&(i=new nh({morphTargets:t,skinning:e}),c[r]=i),i}function T(e,n,r,i,s,o,a){let l=null,c=M,u=e.customDepthMaterial;if(!0===i.isPointLight&&(c=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(t,i,!0===e.isInstancedMesh)}else l=u;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=a===h?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=s,l.farDistance=o),l}function E(n,i,s,o,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;ln||i.y>n)&&(i.x>n&&(s.x=Math.floor(n/p.x),i.x=s.x*p.x,u.mapSize.x=s.x),i.y>n&&(s.y=Math.floor(n/p.y),i.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new jn(i.x,i.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(ot=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),st=ot>=2);let lt=null,ct={};const ht=new Wn,ut=new Wn;function pt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;or||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Fn.floorPowerOfTwo:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===d&&(d=f(s,o));const a=n?f(s,o):d;return a.width=s,a.height=o,a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,i,s){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,s))}function _(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function b(t){return t===ut||t===pt||t===mt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),s=r.get(n);if(!e)return;void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function E(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;C(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=o||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const u=h[0],p=x(u)||a,d=s.convert(r.format),m=s.convert(r.type),f=_(r.internalFormat,d,m);let b;if(R(34067,r,p),o){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),o.memory.textures++)}function P(e,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==ut&&t.minFilter!==gt)}(r)&&!1===x(r.image),c=g(r.image,l,!1,h),u=x(c)||a,p=s.convert(r.format);let d,m=s.convert(r.type),f=_(r.internalFormat,p,m);R(o,r,u);const b=r.mipmaps;if(r.isDepthTexture)f=6402,a?f=r.type===At?36012:r.type===Et?33190:r.type===Dt?35056:33189:r.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===f&&r.type!==St&&r.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=St,m=s.convert(r.type)),r.format===Ht&&6402===f&&(f=34041,r.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Dt,m=s.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t0&&u){for(let t=0,e=b.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,p=i.isDataTexture3D||i.isDataTexture2DArray,d=x(e)||a;if(!a||i.format!==Bt||i.type!==At&&i.type!==Lt||(i.format=Nt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(i.format),r=s.convert(i.type),o=_(i.internalFormat,n,r),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),I(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),R(34067,i,d);for(let t=0;t<6;t++)D(l.__webglFramebuffer[t],e,36064,34069+t);v(i,d)&&y(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;p&&(a?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),R(t,i,d),D(l.__webglFramebuffer,e,36064,t),v(i,d)&&y(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const i=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;n.bindTexture(i,s),y(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===It)return 6406;if(t===Bt)return 6407;if(t===Nt)return 6408;if(t===Ft)return 6409;if(t===Ot)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===re)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===re)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ie||t===se||t===oe||t===ae||t===le||t===ce||t===he||t===ue||t===pe||t===de||t===me||t===fe||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(t=[]){xs.call(this),this.cameras=t}ch.prototype=Object.assign(Object.create(xs.prototype),{constructor:ch,isArrayCamera:!0});class hh extends Xr{constructor(){super(),this.type="Group"}}function uh(){this._targetRay=null,this._grip=null,this._hand=null}function ph(t,e){const n=this;let r=null,i=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new xs;h.layers.enable(1),h.viewport=new Wn;const u=new xs;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new ch;d.layers.enable(1),d.layers.enable(2);let m=null,f=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){c.forEach(function(t,e){t.disconnect(e)}),c.clear(),m=null,f=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=r.inputSources;for(let n=0;n0&&wt(s,t,e),o.length>0&&wt(o,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==_&&(X.updateRenderTargetMipmap(_),X.updateMultisampleRenderTarget(_)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,d.pop(),u=d.length>0?d[d.length-1]:null},this.setFramebuffer=function(t){x!==t&&null===_&&ht.bindFramebuffer(36160,t),x=t},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=x,i=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=o[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),E=t.scissorTest}else S.copy(D).multiplyScalar(R).floor(),T.copy(I).multiplyScalar(R).floor(),E=B;if(b!==r&&(ht.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(T),W.setScissorTest(E),i){const r=q.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(s){const r=q.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==b&&(ht.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Nt&<.convert(l)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===Lt&&(k.has("EXT_color_buffer_half_float")||V.isWebGL2&&k.has("EXT_color_buffer_float"));if(!(c===bt||lt.convert(c)===ht.getParameter(35738)||c===At&&(V.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ht.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),o=lt.convert(e.format);X.setTexture2D(e,0),ht.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=lt.convert(n.format),a=lt.convert(n.type);X.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let h;if(r.isDataTexture3D)X.setTexture3D(r,0),h=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),h=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const u=ht.getParameter(3314),p=ht.getParameter(32878),d=ht.getParameter(3316),m=ht.getParameter(3315),g=ht.getParameter(32877);ht.pixelStorei(3314,s),ht.pixelStorei(32878,o),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),ht.texSubImage3D(h,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,a),ht.pixelStorei(3314,u),ht.pixelStorei(32878,p),ht.pixelStorei(3316,d),ht.pixelStorei(3315,m),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(h),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}exports.Group=hh,hh.prototype.isGroup=!0,Object.assign(uh.prototype,{constructor:uh,getHandSpace:function(){return null===this._hand&&(this._hand=new hh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new hh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new hh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new hh;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const r=l.joints[s.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),this}}),Object.assign(ph.prototype,In.prototype);class gh extends fh{}exports.WebGL1Renderer=gh,gh.prototype.isWebGL1Renderer=!0;class xh{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new xh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=xh,xh.prototype.isFogExp2=!0;class vh{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new vh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=vh,vh.prototype.isFog=!0;class yh extends Xr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function _h(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}exports.Scene=yh,yh.prototype.isScene=!0,Object.defineProperty(_h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_h.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;rt.far||e.push({distance:a,point:Th.clone(),uv:li.getUV(Th,Ph,Dh,Ih,Bh,Nh,Fh,new On),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function zh(t,e,n,r,i,s){Lh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Rh.x=s*Lh.x-i*Lh.y,Rh.y=i*Lh.x+s*Lh.y):Rh.copy(Lh),t.copy(e),t.x+=Rh.x,t.y+=Rh.y,t.applyMatrix4(Ch)}exports.Sprite=Oh,Oh.prototype.isSprite=!0;const Gh=new Yn,Hh=new Yn;class Uh extends Xr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n0){let n,r;for(n=1,r=e.length;n0){Gh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Gh);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Gh.setFromMatrixPosition(t.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=Gh.distanceTo(Hh)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;ro)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);pt.far||e.push({distance:p,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,s=i.count-1;no)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const hu=new Yn,uu=new Yn;function pu(t,e){cu.call(this,t,e),this.type="LineSegments"}pu.prototype=Object.assign(Object.create(cu.prototype),{constructor:pu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;ti.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}yu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:yu,isPoints:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xu.copy(n.boundingSphere),xu.applyMatrix4(r),xu.radius+=i,!1===t.ray.intersectsSphere(xu))return;fu.copy(r).invert(),gu.copy(t.ray).applyMatrix4(fu);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class bu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.format=void 0!==o?o:Bt,this.minFilter=void 0!==s?s:gt,this.magFilter=void 0!==i?i:gt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}exports.VideoTexture=bu,bu.prototype.isVideoTexture=!0;class wu extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}exports.CompressedTexture=wu,wu.prototype.isCompressedTexture=!0;class Mu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.needsUpdate=!0}}exports.CanvasTexture=Mu,Mu.prototype.isCanvasTexture=!0;class Su extends kn{constructor(t,e,n,r,i,s,o,a,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=St),void 0===n&&c===Ht&&(n=Dt),super(null,r,i,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}}exports.DepthTexture=Su,Su.prototype.isDepthTexture=!0;class Tu extends ki{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],l=new Yn,c=new On;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const i=n+h/e*r;l.x=t*Math.cos(i),l.y=t*Math.sin(i),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[u]/t+1)/2,c.y=(s[u+1]/t+1)/2,a.push(c.x,c.y)}for(let h=1;h<=e;h++)i.push(h,h+1,0);this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("normal",new Ci(o,3)),this.setAttribute("uv",new Ci(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Tu;class Eu extends ki{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],h=[],u=[],p=[];let d=0;const m=[],f=n/2;let g=0;function x(n){const i=d,s=new On,m=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=r;t++)h.push(0,f*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=r;t++){const e=t/r*a+o,n=Math.cos(e),i=Math.sin(e);m.x=v*i,m.y=f*y,m.z=v*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*i*y+.5,p.push(s.x,s.y),d++}for(let t=0;t0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Eu;class Au extends Eu{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}}exports.ConeGeometry=exports.ConeBufferGeometry=Au;class Lu extends ki{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),l=i-o;for(let t=0;t<=l;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/l)}for(let o=0;o.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(i.slice(),3)),this.setAttribute("uv",new Ci(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Lu;class Ru extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Ru;const Cu=new Yn,Pu=new Yn,Du=new Yn,Iu=new li;class Bu extends ki{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Fn.DEG2RAD*e),i=t.getIndex(),s=t.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let p=0;p80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),p>h&&(h=p);d=0!==(d=Math.max(c-a,h-l))?1/d:0}return zu(s,o,n,a,l,d),o}};function Fu(t,e,n,r,i){let s,o;if(i===pp(t,e,n,r)>0)for(s=e;s=e;s-=r)o=cp(s,t[s],t[s+1],o);return o&&ep(o,o.next)&&(hp(o),o=o.next),o}function Ou(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!ep(r,r.next)&&0!==tp(r.prev,r,r.next))r=r.next;else{if(hp(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zu(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yu(t,r,i,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hu(t,r,i,s):Gu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),hp(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?zu(t=Uu(Ou(t),e,n),e,n,r,i,s,2):2===o&&ku(t,e,n,r,i,s):zu(Ou(t),e,n,r,i,s,1);break}}function Gu(t){const e=t.prev,n=t,r=t.next;if(tp(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ku(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&tp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Hu(t,e,n,r){const i=t.prev,s=t,o=t.next;if(tp(i,s,o)>=0)return!1;const a=i.xs.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,h=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=Ju(a,l,e,n,r),p=Ju(c,h,e,n,r);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Uu(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!ep(i,s)&&np(i,r,r.next,s)&&op(i,s)&&op(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),hp(r),hp(r.next),r=t=s),r=r.next}while(r!==t);return Ou(r)}function ku(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&$u(o,t)){let a=lp(o,t);return o=Ou(o,o.next),a=Ou(a,a.next),zu(o,e,n,r,i,s),void zu(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function Vu(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&r!==n.x&&Ku(is.x||n.x===s.x&&Xu(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}function Xu(t,e){return tp(t.prev,t,e.prev)<0&&tp(e.next,t,t.next)<0}function Yu(t,e,n,r){let i=t;do{null===i.z&&(i.z=Ju(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zu(i)}function Zu(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function Ju(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Qu(t){let e=t,n=t;do{(e.x=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function $u(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(op(t,e)&&op(e,t)&&ap(t,e)&&(tp(t.prev,t,e.prev)||tp(t,e.prev,e))||ep(t,e)&&tp(t.prev,t,t.next)>0&&tp(e.prev,e,e.next)>0)}function tp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ep(t,e){return t.x===e.x&&t.y===e.y}function np(t,e,n,r){const i=ip(tp(t,e,n)),s=ip(tp(t,e,r)),o=ip(tp(n,r,t)),a=ip(tp(n,r,e));return i!==s&&o!==a||(!(0!==i||!rp(t,n,e))||(!(0!==s||!rp(t,r,e))||(!(0!==o||!rp(n,t,r))||!(0!==a||!rp(n,e,r)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ip(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&np(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function op(t,e){return tp(t.prev,t,t.next)<0?tp(t,e,t.next)>=0&&tp(t,t.prev,e)>=0:tp(t,e,t.prev)<0||tp(t,t.next,e)<0}function ap(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function lp(t,e){const n=new up(t.i,t.x,t.y),r=new up(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cp(t,e,n,r){const i=new up(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function hp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function up(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pp(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function fp(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(l*l+c*c),d=e.x-a/u,m=e.y+o/u,f=((n.x-c/p-d)*c-(n.y+l/p-m)*l)/(o*c-a*l),g=(r=d+o*f-t.x)*r+(i=m+a*f-t.y)*i;if(g<=2)return new On(r,i);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(h)):(r=o,i=a,s=Math.sqrt(h/2))}return new On(r/s,i/s)}const P=[];for(let e=0,n=E.length,r=n-1,i=e+1;e=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*d;t=0?(t(p-1e-5,r,c),h.subVectors(l,c)):(t(p+1e-5,r,c),h.subVectors(c,l)),r-1e-5>=0?(t(p,r-1e-5,c),u.subVectors(l,c)):(t(p,r+1e-5,c),u.subVectors(c,l)),a.crossVectors(h,u).normalize(),s.push(a.x,a.y,a.z),o.push(p,r)}}for(let d=0;d0)&&p.push(e,r,o),(g!==n-1||a=r)){a.push(t.times[s]);for(let n=0;ns.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=e.times[u]){const t=u*l+a,n=t+l-a;p=jp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=l-a;t.evaluate(s),p=jp.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=i.times.length;for(let t=0;t=i)break t;{const o=e[1];t=(i=e[--n-1]))break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==i||s!==r){i>=s&&(i=(s=Math.max(s,1))-1);const t=this.getValueSize();this.times=jp.arraySlice(n,i,s),this.values=jp.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&jp.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=jp.arraySlice(this.times),e=jp.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===ze,i=t.length-1;let s=1;for(let o=1;o0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=jp.arraySlice(t,0,s),this.values=jp.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=jp.arraySlice(this.times,0),e=jp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}exports.KeyframeTrack=Jp,Jp.prototype.TimeBufferType=Float32Array,Jp.prototype.ValueBufferType=Float32Array,Jp.prototype.DefaultInterpolation=Oe;class Qp extends Jp{}exports.BooleanKeyframeTrack=Qp,Qp.prototype.ValueTypeName="bool",Qp.prototype.ValueBufferType=Array,Qp.prototype.DefaultInterpolation=Fe,Qp.prototype.InterpolantFactoryMethodLinear=void 0,Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends Jp{}exports.ColorKeyframeTrack=Kp,Kp.prototype.ValueTypeName="color";class $p extends Jp{}function td(t,e,n,r){qp.call(this,t,e,n,r)}exports.NumberKeyframeTrack=$p,$p.prototype.ValueTypeName="number",td.prototype=Object.assign(Object.create(qp.prototype),{constructor:td,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let l=t*o;for(let c=l+o;l!==c;l+=4)Xn.slerpFlat(i,0,s,l-o,s,l,a);return i}});class ed extends Jp{InterpolantFactoryMethodLinear(t){return new td(this.times,this.values,this.getValueSize(),t)}}exports.QuaternionKeyframeTrack=ed,ed.prototype.ValueTypeName="quaternion",ed.prototype.DefaultInterpolation=Oe,ed.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends Jp{}exports.StringKeyframeTrack=nd,nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=Fe,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends Jp{}exports.VectorKeyframeTrack=rd,rd.prototype.ValueTypeName="vector";class id{constructor(t,e=-1,n,r=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Fn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(od(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(Jp.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];jp.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let c=0;c0||0===t.search(/^data\:image\/jpeg/);i.format=r?Bt:Nt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(yd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)i+=(n=this.getPoint(s/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,l=i-1;for(;a<=l;)if((o=n[r=Math.floor(a+(l-a)/2)]-s)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(i-1);const c=n[r];return(r+(s-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),s=this.getPoint(r),o=e||(i.isVector2?new On:new Yn);return o.copy(s).sub(i).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,r=[],i=[],s=[],o=new Yn,a=new wr;for(let p=0;p<=t;p++){const e=p/t;r[p]=this.getTangentAt(e,new Yn),r[p].normalize()}i[0]=new Yn,s[0]=new Yn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let p=1;p<=t;p++){if(i[p]=i[p-1].clone(),s[p]=s[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Fn.clamp(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(a.makeRotationAxis(o,t))}s[p].crossVectors(r[p],i[p])}if(!0===e){let e=Math.acos(Fn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class _d extends yd{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new On,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?o=r[(l-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),o=Md);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return n.set(Ld(o,a.x,l.x,c.x,h.x),Ld(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[r]-e,i=this.curves[r],s=i.getLength(),o=0===s?0:1-t/s;return i.getPointAt(o)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}exports.Path=Xd;class Yd extends Xd{constructor(t){super(t),this.uuid=Fn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new xi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new On).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new Yn).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Wn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new zn).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new wr).fromArray(e.value);break;default:r.uniforms[i].value=e.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const i in t.extensions)r.extensions[i]=t.extensions[i];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new On).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new On).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}exports.MaterialLoader=fm;const gm={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r0){const n=new ld(e);(i=new fd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[i],l=-l),t.yo.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=dp.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],(l=new Yd).curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let x=0,v=s.length;x1){let t=!1;const e=[];for(let n=0,r=p.length;n0&&(t||(f=u))}for(let x=0,v=p.length;x0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,l=e+e;a!==l;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){Xn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;Xn.multiplyQuaternionsFlat(t,s,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}exports.PropertyMixer=Km;const $m="\\[\\]\\.:\\/",tf=new RegExp("[\\[\\]\\.:\\/]","g"),ef="[^\\[\\]\\.:\\/]",nf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",rf=/((?:WC+[\/:])*)/.source.replace("WC",ef),sf=/(WCOD+)?/.source.replace("WCOD",nf),of=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ef),af=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ef),lf=new RegExp("^"+rf+sf+of+af+"$"),cf=["material","materials","bones"];function hf(t,e,n){const r=n||uf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function uf(t,e,n){this.path=e,this.parsedPath=n||uf.parseTrackName(e),this.node=uf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(hf.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(uf,{Composite:hf,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new uf.Composite(t,e,n):new uf(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(tf,"")},parseTrackName:function(t){const e=lf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==cf.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r=i){const s=i++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[l];e[l]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(h);for(let u=c,p=a.length;u!==p;++u){const n=a[u];h[u]=new uf(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}exports.AnimationObjectGroup=pf,pf.prototype.isAnimationObjectGroup=!0;class df{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:Ge,endingEnd:Ge};for(let l=0;l!==s;++l){const t=i[l].createInterpolant(null);o[l]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Be,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=i,a[1]=i+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case ke:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===Ne;if(0===t)return-1===i?r:s&&1==(1&i)?e-r:r;if(n===Ie){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=He,r.endingEnd=He):(r.endingStart=t?this.zeroSlopeAtStart?He:Ge:Ue,r.endingEnd=e?this.zeroSlopeAtEnd?He:Ge:Ue)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class mf extends In{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let h=0;h!==i;++h){const t=r[h],i=t.name;let l=c[i];if(void 0!==l)s[h]=l;else{if(void 0!==(l=s[h])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,i));continue}const r=e&&e._propertyBindings[h].binding.parsedPath;++(l=new Km(uf.create(n,i,r),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(l,a,i),s[h]=l}o[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l){e[l]._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let l=0;l!==a;++l)o[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new On),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new On),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Mf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=Sf,Sf.prototype.isBox2=!0;const Tf=new Yn,Ef=new Yn;class Af{constructor(t=new Yn,e=new Yn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tf.subVectors(t,this.start),Ef.subVectors(this.end,this.start);const n=Ef.dot(Ef);let r=Ef.dot(Tf)/n;return e&&(r=Fn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Lf(t){Xr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=Af,Lf.prototype=Object.create(Xr.prototype),Lf.prototype.constructor=Lf,Lf.prototype.isImmediateRenderObject=!0;const Rf=new Yn;class Cf extends Xr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ki,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,o=1,a=32;s.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eg,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=ig;class sg extends pu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ki;n.setAttribute("position",new Ci(e,3)),n.setAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=sg;const og=new Float32Array(1),ag=new Int32Array(og.buffer),lg={toHalfFloat:function(t){og[0]=t;const e=ag[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}};exports.DataUtils=lg;const cg=4,hg=8,ug=Math.pow(2,hg),pg=[.125,.215,.35,.446,.526,.582],dg=hg-cg+1+pg.length,mg=20,fg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},gg=new vi({side:p,depthWrite:!1,depthTest:!1}),xg=new os(new cs,gg),vg=new lm,{_lodPlanes:yg,_sizeLods:_g,_sigmas:bg}=Cg(),wg=new xi;let Mg=null;const Sg=(1+Math.sqrt(5))/2,Tg=1/Sg,Eg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Sg,Tg),new Yn(0,Sg,-Tg),new Yn(Tg,0,Sg),new Yn(-Tg,0,Sg),new Yn(Sg,Tg,0),new Yn(-Sg,Tg,0)];function Ag(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Lg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Ig(mg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Mg=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ng(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?ug:0,ug,ug),a.setRenderTarget(r),u&&a.render(xg,i),a.render(t,i)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ng()):null==this._equirectShader&&(this._equirectShader=Bg());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new os(yg[0],r),s=r.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=fg[t.encoding],s.outputEncoding.value=fg[e.texture.encoding],Dg(e,0,0,3*ug,2*ug),n.setRenderTarget(e),n.render(i,vg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;rmg&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${mg}`);const f=[];let g=0;for(let v=0;vhg-cg?r-hg+cg:0),3*x,2*x),a.setRenderTarget(e),a.render(c,vg)}}function Rg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Cg(){const t=[],e=[],n=[];let r=hg;for(let i=0;ihg-cg?o=pg[i-hg+cg-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),x=new Float32Array(m*p*u),v=new Float32Array(f*p*u);for(let t=0;t2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*p*t),x.set(h,m*p*t);const i=[t,t,t,t,t,t];v.set(i,f*p*t)}const y=new ki;y.setAttribute("position",new bi(g,d)),y.setAttribute("uv",new bi(x,m)),y.setAttribute("faceIndex",new bi(v,f)),t.push(y),r>cg&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pg(t){const e=new jn(3*ug,3*ug,t);return e.texture.mapping=ot,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dg(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ig(t){const e=new Float32Array(t),n=new Yn(0,1,0);return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Og()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Bg(){const t=new On(1,1);return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Og()}\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Ng(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Og()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Fg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Og(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}exports.PMREMGenerator=Lg;const zg=0;exports.LineStrip=0;const Gg=1;exports.LinePieces=1;const Hg=0;exports.NoColors=0;const Ug=1;exports.FaceColors=1;const kg=2;function Vg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Wg(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function jg(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yu(t,e)}function qg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Oh(t)}function Xg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yu(t,e)}function Yg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Zg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Jg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Qg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Kg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new bi(t,e).setUsage(Mn)}function $g(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wi(t,e)}function tx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mi(t,e)}function ex(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function nx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ti(t,e)}function rx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ei(t,e)}function ix(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ai(t,e)}function sx(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Li(t,e)}function ox(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function ax(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Pi(t,e)}function lx(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new sg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Kf(t,e)}function hx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pu(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pu(new Dp(t.geometry),new ru({color:void 0!==e?e:16777215}))}function px(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pd(t)}function dx(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xd(t)}function mx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ws(t,n)}function fx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.VertexColors=2,yd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(yd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hd.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gm.extractUrlBase(t)},hd.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Sf.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Sf.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Sf.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sf.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Qn.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},dr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Af.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Fn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Fn.floorPowerOfTwo(t)},Fn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Fn.ceilPowerOfTwo(t)},zn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},zn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},zn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},zn.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wr.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},wr.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},wr.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},wr.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},wr.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},wr.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},wr.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},wr.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},wr.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},wr.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},wr.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},wr.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},wr.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},wr.prototype.makeFrustum=function(t,e,n,r,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,s)},wr.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Qr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Xn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Xn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},br.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},br.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},br.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},li.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},li.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},li.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},li.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},li.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},li.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),li.getBarycoord(t,e,n,r,i)},li.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),li.getNormal(t,e,n,r)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Sp(this,t)},On.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},On.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},On.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Yn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Yn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Yn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Yn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Yn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Yn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Yn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Yn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Yn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Wn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),os.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(os.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Uh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Qh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Xh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(yd.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),xs.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zd.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(bi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),bi.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},bi.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},bi.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ki.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ki.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new bi(arguments[1],arguments[2])))},ki.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ki.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ki.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ki.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ki.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ki.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(xm.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(vf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(_h.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),_h.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},_h.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},gp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},gp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},yh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(ff.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(hi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(zp.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Op.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(fs.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),fh.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},fh.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},fh.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},fh.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},fh.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},fh.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},fh.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},fh.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},fh.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},fh.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},fh.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},fh.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},fh.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},fh.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},fh.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},fh.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},fh.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},fh.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},fh.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},fh.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},fh.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},fh.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},fh.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},fh.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},fh.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(fh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(jm.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Dm).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_s.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},_s.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new vd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new gd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126"); },{}],"xTGv":[function(require,module,exports) { @@ -538,21 +538,21 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"../../../build/three.module.js":"dKqR"}],"a4zN":[function(require,module,exports) { "use strict";function r(r){var e=new Float32Array(6);return e[0]=r.min.x,e[1]=r.min.y,e[2]=r.min.z,e[3]=r.max.x,e[4]=r.max.y,e[5]=r.max.z,e}function e(r,e){return e.min.x=r[0],e.min.y=r[1],e.min.z=r[2],e.max.x=r[3],e.max.y=r[4],e.max.z=r[5],e}function n(r){for(var e=-1,n=-1/0,t=0;t<3;t++){var x=r[t+3]-r[t];x>n&&(n=x,e=t)}return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.boxToArray=r,exports.arrayToBox=e,exports.getLongestEdgeIndex=n; },{}],"jNwr":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("three"),e=require("./Utils/ArrayBoxUtilities.js");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:10,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return i(this,n),(e=o.call(this,"MeshBVHRootVisualizer")).depth=r,e.mesh=t,e._group=u,e.update(),e}return s(n,[{key:"update",value:function(){var r=this,o=this.mesh.geometry.boundsTree,n=0;for(o&&o.traverse(function(o,i,u,s,c){var a=i||c;if(o>=r.depth)return!0;if(o===r.depth-1||a){var l=nn;)this.remove(this.children.pop())}}]),n}(),g=function(e){c(n,t.Group);var r=l(n);function n(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return i(this,n),(e=r.call(this,"MeshBVHVisualizer")).depth=o,e.mesh=t,e._roots=[],e.update(),e}return s(n,[{key:"update",value:function(){for(var t=this.mesh.geometry.boundsTree,e=t?t._roots.length:0;this._roots.length>e;)this._roots.pop();for(var r=0;r=this._roots.length){var o=new b(this.mesh,this.depth,r);this.add(o),this._roots.push(o)}else{var n=this._roots[r];n.depth=this.depth,n.mesh=this.mesh,n.update()}}},{key:"updateMatrixWorld",value:function(){var t;this.position.copy(this.mesh.position),this.rotation.copy(this.mesh.rotation),this.scale.copy(this.mesh.scale);for(var e=arguments.length,r=new Array(e),i=0;i=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=r[Symbol.iterator]()},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,y=-1/0,g=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&by&&(y=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dg&&(g=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=y,a[4]=g,a[5]=h)}function y(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var y=r[l+4];ys&&(s=y)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function g(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=y),g>p&&(p=g);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var y=g(l,f,s,e,a,c);if(y===e||y===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=y-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=y,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),y(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,g),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildTree=b,exports.buildPackedTree=E,exports.IS_LEAFNODE_FLAG=exports.BYTES_PER_NODE=void 0;var r=require("three"),n=a(require("./MeshBVHNode.js")),t=require("./Utils/ArrayBoxUtilities.js"),e=require("./Constants.js");function a(r){return r&&r.__esModule?r:{default:r}}function o(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var e=0,a=function(){};return{s:a,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){f=!0,o=r},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw o}}}}function i(r,n){if(r){if("string"==typeof r)return u(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(r,n):void 0}}function u(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t65535?Uint32Array:Uint16Array)(t);n.setIndex(new r.BufferAttribute(e,1));for(var a=0;a4&&void 0!==arguments[4]?arguments[4]:null,o=1/0,i=1/0,u=1/0,f=-1/0,s=-1/0,l=-1/0,v=1/0,c=1/0,d=1/0,g=-1/0,y=-1/0,h=-1/0,p=null!==a,x=6*n,A=6*(n+t);xf&&(f=E),p&&bg&&(g=b);var D=r[x+2],B=r[x+3],S=D-B,_=D+B;Ss&&(s=_),p&&Dy&&(y=D);var F=r[x+4],M=r[x+5],T=F-M,I=F+M;Tl&&(l=I),p&&Fh&&(h=F)}e[0]=o,e[1]=i,e[2]=u,e[3]=f,e[4]=s,e[5]=l,p&&(a[0]=v,a[1]=c,a[2]=d,a[3]=g,a[4]=y,a[5]=h)}function g(r,n,t,e){for(var a=1/0,o=1/0,i=1/0,u=-1/0,f=-1/0,s=-1/0,l=6*n,v=6*(n+t);lu&&(u=c);var d=r[l+2];df&&(f=d);var g=r[l+4];gs&&(s=g)}e[0]=a,e[1]=o,e[2]=i,e[3]=u,e[4]=f,e[5]=s}function y(r,n,t,e,a,o){for(var i=e,u=e+a-1,f=o.pos,s=2*o.axis;;){for(;i<=u&&n[6*i+s]=f;)u--;if(!(ip&&(p=g),y>p&&(p=y);var x=(p-h)/2,A=2*c;a[u+A+0]=h+x,a[u+A+1]=x+(Math.abs(h)+x)*f}return a}function b(r,a){function i(t,e,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!E&&v>=p&&(E=!0,b&&(console.warn("MeshBVH: Max depth of ".concat(p," reached when generating BVH. Consider increasing maxDepth.")),console.warn(this,r))),a<=w||v>=p)return t.offset=e,t.count=a,t;var c=h(t.boundingData,o,f,s,e,a,m);if(-1===c.axis)return t.offset=e,t.count=a,t;var g=y(l,f,s,e,a,c);if(g===e||g===e+a)t.offset=e,t.count=a;else{t.splitAxis=c.axis;var x=new n.default,A=e,D=g-e;t.left=x,x.boundingData=new Float32Array(6),d(f,A,D,x.boundingData,u),i(x,A,D,u,v+1);var B=new n.default,S=g,_=a-D;t.right=B,B.boundingData=new Float32Array(6),d(f,S,_,B.boundingData,u),i(B,S,_,u,v+1)}return t}v(r);var u=new Float32Array(6),f=A(r),s=a.strategy===e.SAH?x(f):null,l=r.index.array,p=a.maxDepth,b=a.verbose,w=a.maxLeafTris,m=a.strategy,E=!1,D=[],B=c(r);if(1===B.length){var S=new n.default,_=B[0];null!=r.boundingBox?(S.boundingData=(0,t.boxToArray)(r.boundingBox),g(f,_.offset,_.count,u)):(S.boundingData=new Float32Array(6),d(f,_.offset,_.count,S.boundingData,u)),i(S,_.offset,_.count,u),D.push(S)}else{var F,M=o(B);try{for(M.s();!(F=M.n()).done;){var T=F.value,I=new n.default;I.boundingData=new Float32Array(6),d(f,T.offset,T.count,I.boundingData,u),i(I,T.offset,T.count,u),D.push(I)}}catch(j){M.e(j)}finally{M.f()}}return D}var w=32;exports.BYTES_PER_NODE=w;var m=65535;function E(r,n){for(var t,e,a,o=b(r,n),i=[],u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return e[o+6]=d/4,d=c(d,y),e[o+7]=h,d}}exports.IS_LEAFNODE_FLAG=m; },{"three":"dKqR","./MeshBVHNode.js":"qYFu","./Utils/ArrayBoxUtilities.js":"a4zN","./Constants.js":"tuIt"}],"GlCc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.areIntersecting=exports.SeparatingAxisBounds=void 0;var t=require("three");function r(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function e(t,r){for(var e=0;et.max||t.min>this.max}}]),t}();exports.SeparatingAxisBounds=a,a.prototype.setFromBox=function(){var r=new t.Vector3;return function(t,e){for(var n=e.min,a=e.max,i=1/0,o=-1/0,s=0;s<=1;s++)for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){r.x=n.x*s+a.x*(1-s),r.y=n.y*u+a.y*(1-u),r.z=n.z*f+a.z*(1-f);var m=t.dot(r);i=Math.min(m,i),o=Math.max(m,o)}this.min=i,this.max=o}}();var i=function(){var t=new a;return function(r,e){for(var n=r.points,a=r.satAxes,i=r.satBounds,o=e.points,s=e.satAxes,u=e.satBounds,f=0;f<3;f++){var m=i[f],v=a[f];if(t.setFromPoints(v,o),m.isSeparated(t))return!1}for(var c=0;c<3;c++){var x=u[c],h=s[c];if(t.setFromPoints(h,n),x.isSeparated(t))return!1}}}();exports.areIntersecting=i; },{"three":"dKqR"}],"gld0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sphereIntersectTriangle=exports.closestPointsSegmentToSegment=exports.closestPointLineToLine=void 0;var t=require("three"),e=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Vector3;return function(t,r,s){var i=t.start,a=e,c=r.start,d=o;n.subVectors(i,c),e.subVectors(t.end,r.start),o.subVectors(r.end,r.start);var u,P,v=n.dot(d),T=d.dot(a),l=d.dot(d),f=n.dot(a),p=a.dot(a)*l-T*T;P=(v+(u=0!==p?(v*T-f*l)/p:0)*T)/l,s.x=u,s.y=P}}();exports.closestPointLineToLine=e;var o=function(){var o=new t.Vector2,n=new t.Vector3,r=new t.Vector3;return function(t,s,i,a){e(t,s,o);var c,d,u=o.x,P=o.y;if(u>=0&&u<=1&&P>=0&&P<=1)return t.at(u,i),void s.at(P,a);if(u>=0&&u<=1)return P<0?s.at(0,a):s.at(1,a),void t.closestPointToPoint(a,!0,i);if(P>=0&&P<=1)return u<0?t.at(0,i):t.at(1,i),void s.closestPointToPoint(i,!0,a);c=u<0?t.start:t.end,d=P<0?s.start:s.end;var v=n,T=r;return t.closestPointToPoint(d,!0,n),s.closestPointToPoint(c,!0,r),v.distanceToSquared(d)<=T.distanceToSquared(c)?(i.copy(v),void a.copy(d)):(i.copy(c),void a.copy(T))}}();exports.closestPointsSegmentToSegment=o;var n=function(){var e=new t.Vector3,o=new t.Vector3,n=new t.Plane,r=new t.Line3;return function(t,s){var i=t.radius,a=t.center,c=s.a,d=s.b,u=s.c;if(r.start=c,r.end=d,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=c,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;if(r.start=d,r.end=u,r.closestPointToPoint(a,!0,e).distanceTo(a)<=i)return!0;var P=s.getPlane(n);if(Math.abs(P.distanceToPoint(a))<=i){var v=P.projectPoint(a,o);if(s.containsPoint(v))return!0}return!1}}();exports.sphereIntersectTriangle=n; },{"three":"dKqR"}],"HHjx":[function(require,module,exports) { -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeparatingAxisTriangle=void 0;var t=require("three"),e=require("./SeparatingAxisBounds.js"),r=require("./MathUtilities.js");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,r.closestPointsSegmentToSegment)(o,t,e,n),(a=e.distanceToSquared(n))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,n),this.closestPointToPoint(n,e),a&&a.copy(e),c&&c.copy(n)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.needsUpdate&&this.update();for(var a,c=t.start,u=t.end,p=this.points,f=1/0,l=0;l<3;l++){var h=(l+1)%3;o.start.copy(p[l]),o.end.copy(p[h]),(0,n.closestPointsSegmentToSegment)(o,t,e,r),(a=e.distanceToSquared(r))1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.needsUpdate&&t.update(),this.needsUpdate&&this.update(),this.intersectsTriangle(t))return(a||c)&&(this.getMidpoint(e),t.closestPointToPoint(e,r),this.closestPointToPoint(r,e),a&&a.copy(e),c&&c.copy(r)),0;for(var u=1/0,p=0;p<3;p++){var f=void 0,l=o[p],h=t[l];this.closestPointToPoint(h,e),(f=h.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.intersectsBox(t))return(u||c)&&(t.getCenter(a),this.closestPointToPoint(a,i),t.closestPointToPoint(i,a),u&&u.copy(i),c&&c.copy(a)),0;for(var f=s*s,p=t.min,l=t.max,y=this.points,v=1/0,h=0;h<8;h++){var d=y[h];a.copy(d).clamp(p,l);var x=d.distanceToSquared(a);if(x=0;U?(T=r+8,h=p[r+6]):(T=p[r+6],h=r+8);var A=f(T,s,a,u)?c(T,t,n,i,a):null;if(A){var M=A.point[b];if(U?M<=s[h+w]:M>=s[h+w+3])return A}var m=f(h,s,a,u)?c(h,t,n,i,a):null;return A&&m?A.distance<=m.distance?A:m:A||m||null}var p=function(){var e=new a.SeparatingAxisTriangle,n=new r.Box3,i=new r.Box3;return function r(a,s,u,l,x){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,v=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:e,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:n,T=arguments.length>10&&void 0!==arguments[10]?arguments[10]:i;function h(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r+=8);return n[r+6]}function w(r){for(var e=2*r,t=y,n=B;65535!==t[e+15];)e=2*(r=n[r+6]);return n[r+6]+t[e+14]}var b=2*a,U=g,A=y,M=B;if(65535===A[b+15])return x(M[a+6],A[b+14],!1,v,a);var m,j,q,O,N=a+8,C=M[a+6],S=N,I=C;if(c&&(q=d,O=T,(0,t.arrayToBox)(S,U,q),(0,t.arrayToBox)(I,U,O),m=c(q),(j=c(O))5&&void 0!==arguments[5]?arguments[5]:null,T=2*n,h=g,w=y,b=B;if(null===d&&(v.boundingBox||v.computeBoundingBox(),x.set(v.boundingBox.min,v.boundingBox.max,f),x.update(),d=x),!(65535===w[T+15])){var U=n+8,A=b[n+6];return(0,t.arrayToBox)(U,h,s),d.intersectsBox(s)&&r(U,a,p,v,f,d)?!0:((0,t.arrayToBox)(A,h,s),!(!d.intersectsBox(s)||!r(A,a,p,v,f,d)))}var M=p,m=M.index,j=M.attributes.position,q=v.index,O=v.attributes.position,N=b[n+6],C=w[T+14];if(l.copy(f).invert(),v.boundsTree){(0,t.arrayToBox)(n,h,c),c.matrix.copy(l),c.update(),u.geometry=v;var S=v.boundsTree.shapecast(u,{intersectsBounds:function(r){return c.intersectsBox(r)},intersectsTriangle:function(r){r.a.applyMatrix4(f),r.b.applyMatrix4(f),r.c.applyMatrix4(f),r.update();for(var e=3*N,t=3*(C+N);e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,null,[{key:"serialize",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,m=3*d,x=3*(d+a[f+14]);mp&&(p=w),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,O=i[n+6],_=S+s,E=O+s,j=!1,P=c||t&&t.has(_);(P||!e||e.has(_))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(O,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=O+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=m);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(d(this,n),!i.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(i.attributes.position.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the position attribute.");if(i.index&&i.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");(a=Object.assign(f({strategy:t.CENTER,maxDepth:40,maxLeafTris:10,verbose:!0,setBoundingBox:!0},h,!1),a)).strategy=Math.max(0,Math.min(2,a.strategy)),this._roots=null,a[h]||(this._roots=(0,r.buildPackedTree)(i,a),!i.boundingBox&&a.setBoundingBox&&(i.boundingBox=this.getBoundingBox(new e.Box3))),this.geometry=i}return y(n,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e&&Array.isArray(e)&&(e=new Set(e)),t&&Array.isArray(t)&&(t=new Set(t));for(var n,i,a,o,s=this.geometry,u=s.index.array,l=s.attributes.position.array,c=0,f=this._roots,d=0,v=f.length;d2&&void 0!==arguments[2]&&arguments[2],f=2*n;if(a[f+15]===r.IS_LEAFNODE_FLAG){for(var d=i[n+6],v=1/0,h=1/0,g=1/0,p=-1/0,b=-1/0,B=-1/0,x=3*d,m=3*(d+a[f+14]);xp&&(p=T),Ab&&(b=A),kB&&(B=k)}return(o[n+0]!==v||o[n+1]!==h||o[n+2]!==g||o[n+3]!==p||o[n+4]!==b||o[n+5]!==B)&&(o[n+0]=v,o[n+1]=h,o[n+2]=g,o[n+3]=p,o[n+4]=b,o[n+5]=B,!0)}var S=n+8,_=i[n+6],O=S+s,E=_+s,j=!1,P=c||t&&t.has(O);(P||!e||e.has(O))&&(j=y(S,s,P));var F=!1,M=c||t&&t.has(E);(M||!e||e.has(E))&&(F=y(_,s,M));var U=j||F;if(U)for(var I=0;I<3;I++){var q=S+I,G=_+I,L=o[q],V=o[q+3],N=o[G],C=o[G+3];o[n+I]=LC?V:C}return U}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),a=new Uint16Array(n);!function t(o){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var u=2*o;var l=a[u+15]===r.IS_LEAFNODE_FLAG;if(l){var c=i[o+6],f=a[u+14];e(s,l,new Float32Array(n,4*o,6),c,f)}else{var d=o+r.BYTES_PER_NODE/4,v=i[o+6],y=i[o+7],h=e(s,l,new Float32Array(n,4*o,6),y);h||(t(d,s+1),t(v,s+1))}}(0)}},{key:"raycast",value:function(e,t,r,n){var i,a=this.geometry,s=u(this._roots);try{for(s.s();!(i=s.n()).done;){var l=i.value;(0,o.setBuffer)(l),(0,o.raycast)(0,e,a,t,r,n),(0,o.clearBuffer)()}}catch(c){s.e(c)}finally{s.f()}}},{key:"raycastFirst",value:function(e,t,r){var n,i=this.geometry,a=null,s=u(this._roots);try{for(s.s();!(n=s.n()).done;){var l=n.value;(0,o.setBuffer)(l);var c=(0,o.raycastFirst)(0,e,i,t,r);(0,o.clearBuffer)(),null!=c&&(null==a||c.distance3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1/0;t.boundingBox||t.computeBoundingBox(),g.set(t.boundingBox.min,t.boundingBox.max,r),g.update();var u=t.attributes.position,l=t.index,c=null,f=null;n&&(c=B),i&&(f=x);var d=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return g.distanceToBox(e,Math.min(d,s))},intersectsBounds:function(e,t,r){return rd)){b.update();var h=e.distanceToTriangle(b,c,f);if(h3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,a=n*n,o=i*i,s=1/0;return this.shapecast(e,{boundsTraverseOrder:function(e){return p.copy(t).clamp(e.min,e.max),p.distanceToSquared(t)},intersectsBounds:function(e,t,r){return r2&&void 0!==arguments[2])||arguments[2],n=e._roots,i=t.getIndex();return{roots:n,index:r?i.array.slice():i.array}}},{key:"deserialize",value:function(t,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.index,o=t.roots,s=new n(r,f({},h,!0));if(s._roots=o,i){var u=r.getIndex();if(null===u){var l=new e.BufferAttribute(t.index,1,!1);r.setIndex(l)}else u.array!==a&&(u.array.set(a),u.needsUpdate=!0)}return s}}]),n}();exports.default=T; },{"three":"dKqR","./Constants.js":"tuIt","./buildFunctions.js":"IMAa","./Utils/OrientedBox.js":"KHU9","./Utils/SeparatingAxisTriangle.js":"HHjx","./Utils/TriangleUtils.js":"AtwI","./castFunctions.js":"mmvR","./Utils/BufferNodeUtils.js":"dxfM"}],"uNJb":[function(require,module,exports) { "use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(n){switch(t(n)){case"number":return 8;case"string":return 2*n.length;case"boolean":return 4;default:return 0}}function e(t){return/(Uint|Int|Float)(8|16|32)Array/.test(t.constructor.name)}function r(t,n){var e={total:0,depth:{min:1/0,max:-1/0},tris:{min:1/0,max:-1/0},splits:[0,0,0]};return t.traverse(function(t,n,r,o,i){e.total++,n?(e.depth.min=Math.min(t,e.depth.min),e.depth.max=Math.max(t,e.depth.max),e.tris.min=Math.min(i,e.tris.min),e.tris.max=Math.max(i,e.tris.max)):e.splits[o]++},n),e.tris.min===1/0&&(e.tris.min=0,e.tris.max=0),e.depth.min===1/0&&(e.depth.min=0,e.depth.max=0),e}function o(t){return t._roots.map(function(n,e){return r(t,e)})}function i(r){for(var o=new Set,i=[r],a=0;i.length;){var s=i.pop();if(!o.has(s))for(var m in o.add(s),s)if(s.hasOwnProperty(m)){a+=n(m);var u=s[m];!u||"object"!==t(u)&&"function"!=typeof u?a+=n(u):e(u)?a+=u.byteLength:u instanceof ArrayBuffer?a+=u.byteLength:i.push(u)}}return a}Object.defineProperty(exports,"__esModule",{value:!0}),exports.estimateMemoryInBytes=i,exports.getBVHExtremes=o; },{}],"HxoX":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MeshBVHDebug=void 0;var e=require("three"),t=require("./Utils/ArrayBoxUtilities.js");function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} +},{}],"eDdU":[function(require,module,exports) { +"use strict";require("core-js/modules/es6.array.copy-within.js"),require("core-js/modules/es6.array.fill.js"),require("core-js/modules/es6.array.filter.js"),require("core-js/modules/es6.array.find.js"),require("core-js/modules/es6.array.find-index.js"),require("core-js/modules/es7.array.flat-map.js"),require("core-js/modules/es6.array.from.js"),require("core-js/modules/es7.array.includes.js"),require("core-js/modules/es6.array.iterator.js"),require("core-js/modules/es6.array.map.js"),require("core-js/modules/es6.array.of.js"),require("core-js/modules/es6.array.slice.js"),require("core-js/modules/es6.array.sort.js"),require("core-js/modules/es6.array.species.js"),require("core-js/modules/es6.date.to-primitive.js"),require("core-js/modules/es6.function.has-instance.js"),require("core-js/modules/es6.function.name.js"),require("core-js/modules/es6.map.js"),require("core-js/modules/es6.math.acosh.js"),require("core-js/modules/es6.math.asinh.js"),require("core-js/modules/es6.math.atanh.js"),require("core-js/modules/es6.math.cbrt.js"),require("core-js/modules/es6.math.clz32.js"),require("core-js/modules/es6.math.cosh.js"),require("core-js/modules/es6.math.expm1.js"),require("core-js/modules/es6.math.fround.js"),require("core-js/modules/es6.math.hypot.js"),require("core-js/modules/es6.math.imul.js"),require("core-js/modules/es6.math.log1p.js"),require("core-js/modules/es6.math.log10.js"),require("core-js/modules/es6.math.log2.js"),require("core-js/modules/es6.math.sign.js"),require("core-js/modules/es6.math.sinh.js"),require("core-js/modules/es6.math.tanh.js"),require("core-js/modules/es6.math.trunc.js"),require("core-js/modules/es6.number.constructor.js"),require("core-js/modules/es6.number.epsilon.js"),require("core-js/modules/es6.number.is-finite.js"),require("core-js/modules/es6.number.is-integer.js"),require("core-js/modules/es6.number.is-nan.js"),require("core-js/modules/es6.number.is-safe-integer.js"),require("core-js/modules/es6.number.max-safe-integer.js"),require("core-js/modules/es6.number.min-safe-integer.js"),require("core-js/modules/es6.number.parse-float.js"),require("core-js/modules/es6.number.parse-int.js"),require("core-js/modules/es6.object.assign.js"),require("core-js/modules/es7.object.define-getter.js"),require("core-js/modules/es7.object.define-setter.js"),require("core-js/modules/es7.object.entries.js"),require("core-js/modules/es6.object.freeze.js"),require("core-js/modules/es6.object.get-own-property-descriptor.js"),require("core-js/modules/es7.object.get-own-property-descriptors.js"),require("core-js/modules/es6.object.get-own-property-names.js"),require("core-js/modules/es6.object.get-prototype-of.js"),require("core-js/modules/es7.object.lookup-getter.js"),require("core-js/modules/es7.object.lookup-setter.js"),require("core-js/modules/es6.object.prevent-extensions.js"),require("core-js/modules/es6.object.to-string.js"),require("core-js/modules/es6.object.is.js"),require("core-js/modules/es6.object.is-frozen.js"),require("core-js/modules/es6.object.is-sealed.js"),require("core-js/modules/es6.object.is-extensible.js"),require("core-js/modules/es6.object.keys.js"),require("core-js/modules/es6.object.seal.js"),require("core-js/modules/es7.object.values.js"),require("core-js/modules/es6.promise.js"),require("core-js/modules/es7.promise.finally.js"),require("core-js/modules/es6.reflect.apply.js"),require("core-js/modules/es6.reflect.construct.js"),require("core-js/modules/es6.reflect.define-property.js"),require("core-js/modules/es6.reflect.delete-property.js"),require("core-js/modules/es6.reflect.get.js"),require("core-js/modules/es6.reflect.get-own-property-descriptor.js"),require("core-js/modules/es6.reflect.get-prototype-of.js"),require("core-js/modules/es6.reflect.has.js"),require("core-js/modules/es6.reflect.is-extensible.js"),require("core-js/modules/es6.reflect.own-keys.js"),require("core-js/modules/es6.reflect.prevent-extensions.js"),require("core-js/modules/es6.reflect.set.js"),require("core-js/modules/es6.reflect.set-prototype-of.js"),require("core-js/modules/es6.regexp.constructor.js"),require("core-js/modules/es6.regexp.flags.js"),require("core-js/modules/es6.regexp.match.js"),require("core-js/modules/es6.regexp.replace.js"),require("core-js/modules/es6.regexp.split.js"),require("core-js/modules/es6.regexp.search.js"),require("core-js/modules/es6.regexp.to-string.js"),require("core-js/modules/es6.set.js"),require("core-js/modules/es6.symbol.js"),require("core-js/modules/es7.symbol.async-iterator.js"),require("core-js/modules/es6.string.anchor.js"),require("core-js/modules/es6.string.big.js"),require("core-js/modules/es6.string.blink.js"),require("core-js/modules/es6.string.bold.js"),require("core-js/modules/es6.string.code-point-at.js"),require("core-js/modules/es6.string.ends-with.js"),require("core-js/modules/es6.string.fixed.js"),require("core-js/modules/es6.string.fontcolor.js"),require("core-js/modules/es6.string.fontsize.js"),require("core-js/modules/es6.string.from-code-point.js"),require("core-js/modules/es6.string.includes.js"),require("core-js/modules/es6.string.italics.js"),require("core-js/modules/es6.string.iterator.js"),require("core-js/modules/es6.string.link.js"),require("core-js/modules/es7.string.pad-start.js"),require("core-js/modules/es7.string.pad-end.js"),require("core-js/modules/es6.string.raw.js"),require("core-js/modules/es6.string.repeat.js"),require("core-js/modules/es6.string.small.js"),require("core-js/modules/es6.string.starts-with.js"),require("core-js/modules/es6.string.strike.js"),require("core-js/modules/es6.string.sub.js"),require("core-js/modules/es6.string.sup.js"),require("core-js/modules/es7.string.trim-left.js"),require("core-js/modules/es7.string.trim-right.js"),require("core-js/modules/es6.typed.array-buffer.js"),require("core-js/modules/es6.typed.int8-array.js"),require("core-js/modules/es6.typed.uint8-array.js"),require("core-js/modules/es6.typed.uint8-clamped-array.js"),require("core-js/modules/es6.typed.int16-array.js"),require("core-js/modules/es6.typed.uint16-array.js"),require("core-js/modules/es6.typed.int32-array.js"),require("core-js/modules/es6.typed.uint32-array.js"),require("core-js/modules/es6.typed.float32-array.js"),require("core-js/modules/es6.typed.float64-array.js"),require("core-js/modules/es6.weak-map.js"),require("core-js/modules/es6.weak-set.js"),require("core-js/modules/web.timers.js"),require("core-js/modules/web.immediate.js"),require("core-js/modules/web.dom.iterable.js");var e=d(require("stats.js")),r=a(require("dat.gui")),s=a(require("three")),o=require("three/examples/jsm/controls/OrbitControls.js"),t=require("three/examples/jsm/controls/TransformControls.js"),i=d(require("../src/MeshBVHVisualizer.js")),u=require("../src/index.js");function n(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,s=new WeakMap;return(n=function(e){return e?s:r})(e)}function a(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var s=n(r);if(s&&s.has(e))return s.get(e);var o={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var u=t?Object.getOwnPropertyDescriptor(e,i):null;u&&(u.get||u.set)?Object.defineProperty(o,i,u):o[i]=e[i]}return o.default=e,s&&s.set(e,o),o}function d(e){return e&&e.__esModule?e:{default:e}}require("regenerator-runtime/runtime.js"),s.Mesh.prototype.raycast=u.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=u.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=u.disposeBoundsTree;var j,l,c,m,p,q,y,f,h={speed:1,visualizeBounds:!1,visualBoundsDepth:10,shape:"sphere",position:new s.Vector3,rotation:new s.Euler,scale:new s.Vector3(1,1,1)},g={};function w(){(m=new s.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),m.setSize(window.innerWidth,window.innerHeight),m.setClearColor(1251612,1),document.body.appendChild(m.domElement),(l=new s.Scene).fog=new s.Fog(1251612,20,60);var i=new s.DirectionalLight(16777215,.5);i.position.set(1,1,1),l.add(i),l.add(new s.AmbientLight(16777215,.4));var u=new s.TorusKnotBufferGeometry(1,.4,400,100),n=new s.MeshPhongMaterial({color:16777215,side:s.DoubleSide});(f=new s.Mesh(u,n)).geometry.computeBoundsTree(),l.add(f),(c=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(3,3,3),c.far=100,c.updateProjectionMatrix(),y=new t.TransformControls(c,m.domElement),l.add(y),p=new o.OrbitControls(c,m.domElement),j=new e.default,document.body.appendChild(j.dom);var a=new s.MeshStandardMaterial({metalness:.1,transparent:!0,opacity:.75,premultipliedAlpha:!0});g.sphere=new s.Mesh(new s.SphereBufferGeometry(1,50,50),a),l.add(g.sphere),g.box=new s.Mesh(new s.BoxBufferGeometry(1,1,1),a),l.add(g.box),g.geometry=new s.Mesh(new s.TorusKnotBufferGeometry(.5,.2,200,50),a),g.geometry.geometry.computeBoundsTree(),l.add(g.geometry);var d=new r.GUI;d.add(h,"speed").min(0).max(10),d.add(h,"visualizeBounds").onChange(function(){return b()}),d.add(h,"visualBoundsDepth").min(1).max(40).step(1).onChange(function(){return b()}),d.add(h,"shape",["sphere","box","geometry"]),d.add(y,"mode",["translate","rotate"]);var q=d.addFolder("position");q.add(h.position,"x").min(-5).max(5).step(.001),q.add(h.position,"y").min(-5).max(5).step(.001),q.add(h.position,"z").min(-5).max(5).step(.001),q.open();var w=d.addFolder("rotation");w.add(h.rotation,"x").min(-Math.PI).max(Math.PI).step(.001),w.add(h.rotation,"y").min(-Math.PI).max(Math.PI).step(.001),w.add(h.rotation,"z").min(-Math.PI).max(Math.PI).step(.001),w.open(),d.open(),y.addEventListener("change",function(){h.position.copy(g[h.shape].position),h.rotation.copy(g[h.shape].rotation),h.scale.copy(g[h.shape].scale),d.updateDisplay()}),y.addEventListener("mouseDown",function(){p.enabled=!1}),y.addEventListener("mouseUp",function(){p.enabled=!0}),p.addEventListener("start",function(){y.enabled=!1}),p.addEventListener("end",function(){y.enabled=!0}),window.addEventListener("resize",function(){c.aspect=window.innerWidth/window.innerHeight,c.updateProjectionMatrix(),m.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("keydown",function(e){switch(e.key){case"w":y.mode="translate";break;case"e":y.mode="rotate"}d.updateDisplay()})}function b(){q&&!h.visualizeBounds&&(l.remove(q),q=null),!q&&h.visualizeBounds&&(q=new i.default(f),l.add(q)),q&&(q.depth=h.visualBoundsDepth)}var v=window.performance.now();function x(){var e=window.performance.now()-v;for(var r in v=window.performance.now(),f.rotation.y+=h.speed*e*.001,f.updateMatrixWorld(),j.begin(),q&&q.update(),m.render(l,c),j.end(),g)g[r].visible=!1;var o=h.shape,t=g[o];t.visible=!0,t.position.copy(h.position),t.rotation.copy(h.rotation),t.scale.copy(h.scale);var i=(new s.Matrix4).copy(f.matrixWorld).invert().multiply(t.matrixWorld);if("sphere"===o){var u=new s.Sphere(void 0,1);u.applyMatrix4(i);var n=f.geometry.boundsTree.intersectsSphere(f,u);t.material.color.set(n?15277667:6710886),t.material.emissive.set(15277667).multiplyScalar(n?.25:0)}else if("box"===o){var a=new s.Box3;a.min.set(-.5,-.5,-.5),a.max.set(.5,.5,.5);var d=f.geometry.boundsTree.intersectsBox(f,a,i);t.material.color.set(d?15277667:6710886),t.material.emissive.set(15277667).multiplyScalar(d?.25:0)}else if("geometry"===o){var p=f.geometry.boundsTree.intersectsGeometry(f,t.geometry,i);t.material.color.set(p?15277667:6710886),t.material.emissive.set(15277667).multiplyScalar(p?.25:0)}y.object!==t&&y.attach(t),requestAnimationFrame(x)}w(),b(),x(); +},{"core-js/modules/es6.array.copy-within.js":"tWTB","core-js/modules/es6.array.fill.js":"hUQ6","core-js/modules/es6.array.filter.js":"GyG6","core-js/modules/es6.array.find.js":"Qppk","core-js/modules/es6.array.find-index.js":"sVmK","core-js/modules/es7.array.flat-map.js":"I8vV","core-js/modules/es6.array.from.js":"RRcs","core-js/modules/es7.array.includes.js":"TLss","core-js/modules/es6.array.iterator.js":"wVEN","core-js/modules/es6.array.map.js":"RBsu","core-js/modules/es6.array.of.js":"RB6b","core-js/modules/es6.array.slice.js":"btFn","core-js/modules/es6.array.sort.js":"nrVf","core-js/modules/es6.array.species.js":"smn3","core-js/modules/es6.date.to-primitive.js":"jQnQ","core-js/modules/es6.function.has-instance.js":"a7bX","core-js/modules/es6.function.name.js":"N3yi","core-js/modules/es6.map.js":"ioKM","core-js/modules/es6.math.acosh.js":"py3M","core-js/modules/es6.math.asinh.js":"ob11","core-js/modules/es6.math.atanh.js":"iUik","core-js/modules/es6.math.cbrt.js":"YRuK","core-js/modules/es6.math.clz32.js":"R2Qc","core-js/modules/es6.math.cosh.js":"nEse","core-js/modules/es6.math.expm1.js":"AmoX","core-js/modules/es6.math.fround.js":"vmlq","core-js/modules/es6.math.hypot.js":"kLut","core-js/modules/es6.math.imul.js":"A8J8","core-js/modules/es6.math.log1p.js":"qtpC","core-js/modules/es6.math.log10.js":"VUW8","core-js/modules/es6.math.log2.js":"Jo9J","core-js/modules/es6.math.sign.js":"mZl9","core-js/modules/es6.math.sinh.js":"m0zb","core-js/modules/es6.math.tanh.js":"Fnqw","core-js/modules/es6.math.trunc.js":"tiOR","core-js/modules/es6.number.constructor.js":"kRGG","core-js/modules/es6.number.epsilon.js":"DzYy","core-js/modules/es6.number.is-finite.js":"FuY7","core-js/modules/es6.number.is-integer.js":"pwRL","core-js/modules/es6.number.is-nan.js":"SsgJ","core-js/modules/es6.number.is-safe-integer.js":"qVIE","core-js/modules/es6.number.max-safe-integer.js":"shx2","core-js/modules/es6.number.min-safe-integer.js":"ifBH","core-js/modules/es6.number.parse-float.js":"yjyf","core-js/modules/es6.number.parse-int.js":"Guno","core-js/modules/es6.object.assign.js":"K3Jy","core-js/modules/es7.object.define-getter.js":"guoQ","core-js/modules/es7.object.define-setter.js":"HMp9","core-js/modules/es7.object.entries.js":"gxEP","core-js/modules/es6.object.freeze.js":"EO7q","core-js/modules/es6.object.get-own-property-descriptor.js":"nIty","core-js/modules/es7.object.get-own-property-descriptors.js":"BQD8","core-js/modules/es6.object.get-own-property-names.js":"i23Y","core-js/modules/es6.object.get-prototype-of.js":"ud3u","core-js/modules/es7.object.lookup-getter.js":"HB2g","core-js/modules/es7.object.lookup-setter.js":"QF5J","core-js/modules/es6.object.prevent-extensions.js":"llMc","core-js/modules/es6.object.to-string.js":"zTK3","core-js/modules/es6.object.is.js":"MlqR","core-js/modules/es6.object.is-frozen.js":"Z1rp","core-js/modules/es6.object.is-sealed.js":"Fckj","core-js/modules/es6.object.is-extensible.js":"EYbC","core-js/modules/es6.object.keys.js":"m9aB","core-js/modules/es6.object.seal.js":"GYFR","core-js/modules/es7.object.values.js":"Ltmz","core-js/modules/es6.promise.js":"Pjta","core-js/modules/es7.promise.finally.js":"l1j0","core-js/modules/es6.reflect.apply.js":"F0Xu","core-js/modules/es6.reflect.construct.js":"JlFO","core-js/modules/es6.reflect.define-property.js":"S841","core-js/modules/es6.reflect.delete-property.js":"JRlJ","core-js/modules/es6.reflect.get.js":"kv8Z","core-js/modules/es6.reflect.get-own-property-descriptor.js":"zj1X","core-js/modules/es6.reflect.get-prototype-of.js":"d0aC","core-js/modules/es6.reflect.has.js":"OWTq","core-js/modules/es6.reflect.is-extensible.js":"deHu","core-js/modules/es6.reflect.own-keys.js":"e6SV","core-js/modules/es6.reflect.prevent-extensions.js":"BmyK","core-js/modules/es6.reflect.set.js":"K46i","core-js/modules/es6.reflect.set-prototype-of.js":"L5z5","core-js/modules/es6.regexp.constructor.js":"BenF","core-js/modules/es6.regexp.flags.js":"pDhD","core-js/modules/es6.regexp.match.js":"RTfC","core-js/modules/es6.regexp.replace.js":"KGao","core-js/modules/es6.regexp.split.js":"aOHf","core-js/modules/es6.regexp.search.js":"zOab","core-js/modules/es6.regexp.to-string.js":"iflU","core-js/modules/es6.set.js":"coyu","core-js/modules/es6.symbol.js":"uVn9","core-js/modules/es7.symbol.async-iterator.js":"DlMC","core-js/modules/es6.string.anchor.js":"USd7","core-js/modules/es6.string.big.js":"c1D0","core-js/modules/es6.string.blink.js":"Ee86","core-js/modules/es6.string.bold.js":"ry39","core-js/modules/es6.string.code-point-at.js":"zR9y","core-js/modules/es6.string.ends-with.js":"zRn7","core-js/modules/es6.string.fixed.js":"AHLq","core-js/modules/es6.string.fontcolor.js":"H7V0","core-js/modules/es6.string.fontsize.js":"Dx83","core-js/modules/es6.string.from-code-point.js":"xSM3","core-js/modules/es6.string.includes.js":"fH7p","core-js/modules/es6.string.italics.js":"fRhg","core-js/modules/es6.string.iterator.js":"tbKg","core-js/modules/es6.string.link.js":"Aaz0","core-js/modules/es7.string.pad-start.js":"SWNE","core-js/modules/es7.string.pad-end.js":"n20m","core-js/modules/es6.string.raw.js":"t29D","core-js/modules/es6.string.repeat.js":"C85R","core-js/modules/es6.string.small.js":"qBr3","core-js/modules/es6.string.starts-with.js":"w2SA","core-js/modules/es6.string.strike.js":"eNyu","core-js/modules/es6.string.sub.js":"BVLK","core-js/modules/es6.string.sup.js":"kMsL","core-js/modules/es7.string.trim-left.js":"ppxd","core-js/modules/es7.string.trim-right.js":"hxx1","core-js/modules/es6.typed.array-buffer.js":"NJ0a","core-js/modules/es6.typed.int8-array.js":"wqMZ","core-js/modules/es6.typed.uint8-array.js":"QTtY","core-js/modules/es6.typed.uint8-clamped-array.js":"Kqgs","core-js/modules/es6.typed.int16-array.js":"fEGw","core-js/modules/es6.typed.uint16-array.js":"xyd6","core-js/modules/es6.typed.int32-array.js":"hIko","core-js/modules/es6.typed.uint32-array.js":"tNPN","core-js/modules/es6.typed.float32-array.js":"wisA","core-js/modules/es6.typed.float64-array.js":"mbTX","core-js/modules/es6.weak-map.js":"D6DP","core-js/modules/es6.weak-set.js":"bRUR","core-js/modules/web.timers.js":"OTsy","core-js/modules/web.immediate.js":"hZLH","core-js/modules/web.dom.iterable.js":"v6Aj","stats.js":"dnrf","dat.gui":"KkZG","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/controls/TransformControls.js":"pE3U","../src/MeshBVHVisualizer.js":"jNwr","../src/index.js":"uBxZ","regenerator-runtime/runtime.js":"QVnC"}]},{},["eDdU"], null) \ No newline at end of file From 83729d5f34e8981805ccb4630a2d4155d9b60c95 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 21 May 2021 17:52:42 -0700 Subject: [PATCH 138/139] remove lazy generation flag --- example/asyncGenerate.js | 2 +- example/distancecast.js | 2 +- example/physics.js | 2 +- example/pointCloudIntersection.js | 2 +- example/randomSampleDebug.js | 2 +- example/raycast.js | 15 +-------------- example/selection.js | 2 +- 7 files changed, 7 insertions(+), 20 deletions(-) diff --git a/example/asyncGenerate.js b/example/asyncGenerate.js index ae654a312..65163cf4e 100644 --- a/example/asyncGenerate.js +++ b/example/asyncGenerate.js @@ -204,7 +204,7 @@ function regenerateKnot() { } else { - knot.geometry.boundsTree = new MeshBVH( knot.geometry, { lazyGeneration: false } ); + knot.geometry.boundsTree = new MeshBVH( knot.geometry ); totalStallTime = window.performance.now() - stallStartTime; group.add( knot ); diff --git a/example/distancecast.js b/example/distancecast.js index ec14990a1..a53220836 100644 --- a/example/distancecast.js +++ b/example/distancecast.js @@ -85,7 +85,7 @@ function init() { } planeGeom.computeVertexNormals(); - planeGeom.computeBoundsTree( { lazyGeneration: false } ); + planeGeom.computeBoundsTree(); terrain = new THREE.Mesh( planeGeom, new THREE.MeshStandardMaterial( { color: 0xFFFFFF, metalness: 0.1, roughness: 0.9, side: THREE.DoubleSide } ) ); terrain.rotation.x = - Math.PI / 2; diff --git a/example/physics.js b/example/physics.js index c128f50dd..ba48cb081 100644 --- a/example/physics.js +++ b/example/physics.js @@ -214,7 +214,7 @@ function loadColliderEnvironment() { // create the merged geometry const mergedGeometry = BufferGeometryUtils.mergeBufferGeometries( geometries, false ); - mergedGeometry.boundsTree = new MeshBVH( mergedGeometry, { lazyGeneration: false } ); + mergedGeometry.boundsTree = new MeshBVH( mergedGeometry ); collider = new THREE.Mesh( mergedGeometry ); collider.material.wireframe = true; diff --git a/example/pointCloudIntersection.js b/example/pointCloudIntersection.js index 41d805a32..8f069b321 100644 --- a/example/pointCloudIntersection.js +++ b/example/pointCloudIntersection.js @@ -89,7 +89,7 @@ function init() { bvhGeometry.setIndex( indices ); const bvhMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); bvhMesh = new THREE.Mesh( bvhGeometry, bvhMaterial ); - bvhMesh.geometry.computeBoundsTree( { lazyGeneration: false } ); + bvhMesh.geometry.computeBoundsTree(); helper = new MeshBVHVisualizer( bvhMesh, params.depth ); scene.add( helper ); diff --git a/example/randomSampleDebug.js b/example/randomSampleDebug.js index b704b59c9..dcae5652f 100644 --- a/example/randomSampleDebug.js +++ b/example/randomSampleDebug.js @@ -58,7 +58,7 @@ function init() { const transformSeed = 7830035629; const raySeed = 4697211981; - const options = { strategy: AVERAGE, packData: false, lazyGeneration: false, maxDepth: 1 }; + const options = { strategy: AVERAGE, packData: false, maxDepth: 1 }; const geometry = new THREE.TorusBufferGeometry( 1, 1, 40, 10 ); geometry.computeBoundsTree( options ); diff --git a/example/raycast.js b/example/raycast.js index d40bc7d86..8653acfd1 100644 --- a/example/raycast.js +++ b/example/raycast.js @@ -66,7 +66,6 @@ const params = { mesh: { splitStrategy: CENTER, - lazyGeneration: true, count: 1, useBoundsTree: true, visualizeBounds: false, @@ -177,7 +176,7 @@ const updateFromOptions = () => { if ( params.mesh.useBoundsTree && ! knotGeometry.boundsTree ) { console.time( 'computing bounds tree' ); - knotGeometry.computeBoundsTree( { strategy: params.mesh.splitStrategy, lazyGeneration: params.mesh.lazyGeneration } ); + knotGeometry.computeBoundsTree( { strategy: params.mesh.splitStrategy } ); knotGeometry.boundsTree.splitStrategy = params.mesh.splitStrategy; console.timeEnd( 'computing bounds tree' ); @@ -270,12 +269,6 @@ const render = () => { } ); containerObj.updateMatrixWorld(); - if ( boundsViz && params.mesh.lazyGeneration ) { - - boundsViz.update(); - - } - rayCasterObjects.forEach( f => f.update() ); renderer.render( scene, camera ); @@ -297,12 +290,6 @@ rcFolder.open(); const meshFolder = gui.addFolder( 'Mesh' ); meshFolder.add( params.mesh, 'useBoundsTree' ).onChange( () => updateFromOptions() ); -meshFolder.add( params.mesh, 'lazyGeneration' ).onChange( () => { - - knotGeometry.disposeBoundsTree(); - updateFromOptions(); - -} ); meshFolder.add( params.mesh, 'splitStrategy', { 'CENTER': CENTER, 'SAH': SAH, 'AVERAGE': AVERAGE } ).onChange( () => updateFromOptions() ); meshFolder.add( params.mesh, 'count' ).min( 1 ).max( 300 ).step( 1 ).onChange( () => updateFromOptions() ); meshFolder.add( params.mesh, 'speed' ).min( 0 ).max( 20 ); diff --git a/example/selection.js b/example/selection.js index b5935c0f1..d774af535 100644 --- a/example/selection.js +++ b/example/selection.js @@ -88,7 +88,7 @@ function init() { polygonOffsetFactor: 1, } ) ); - mesh.geometry.boundsTree = new MeshBVH( mesh.geometry, { lazyGeneration: false } ); + mesh.geometry.boundsTree = new MeshBVH( mesh.geometry ); mesh.geometry.setAttribute( 'color', new THREE.Uint8BufferAttribute( new Array( mesh.geometry.index.count * 3 ).fill( 255 ), 3, true ) ); From 080ff1e4a65128dc5a014a0676dbbad7f85552fc Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 21 May 2021 17:57:05 -0700 Subject: [PATCH 139/139] npm run build --- example/bundle/asyncGenerate.4a48c6e8.js | 2 +- example/bundle/distancecast.4107d8f2.js | 2 +- example/bundle/physics.50b811f1.js | 2 +- example/bundle/pointCloudIntersection.fd058085.js | 2 +- example/bundle/randomSampleDebug.32ad2b43.js | 2 +- example/bundle/raycast.88074831.js | 2 +- example/bundle/selection.383a520f.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/example/bundle/asyncGenerate.4a48c6e8.js b/example/bundle/asyncGenerate.4a48c6e8.js index a80d1bc26..ade481009 100644 --- a/example/bundle/asyncGenerate.4a48c6e8.js +++ b/example/bundle/asyncGenerate.4a48c6e8.js @@ -44,5 +44,5 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module },{"three":"dKqR","./Utils/ArrayBoxUtilities.js":"a4zN"}],"uBxZ":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.acceleratedRaycast=f,exports.computeBoundsTree=p,exports.disposeBoundsTree=b,Object.defineProperty(exports,"MeshBVH",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"Visualizer",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"MeshBVHVisualizer",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"CENTER",{enumerable:!0,get:function(){return n.CENTER}}),Object.defineProperty(exports,"AVERAGE",{enumerable:!0,get:function(){return n.AVERAGE}}),Object.defineProperty(exports,"SAH",{enumerable:!0,get:function(){return n.SAH}}),Object.defineProperty(exports,"NOT_INTERSECTED",{enumerable:!0,get:function(){return n.NOT_INTERSECTED}}),Object.defineProperty(exports,"INTERSECTED",{enumerable:!0,get:function(){return n.INTERSECTED}}),Object.defineProperty(exports,"CONTAINED",{enumerable:!0,get:function(){return n.CONTAINED}}),Object.defineProperty(exports,"getBVHExtremes",{enumerable:!0,get:function(){return s.getBVHExtremes}}),Object.defineProperty(exports,"estimateMemoryInBytes",{enumerable:!0,get:function(){return s.estimateMemoryInBytes}}),Object.defineProperty(exports,"MeshBVHDebug",{enumerable:!0,get:function(){return u.MeshBVHDebug}});var e=require("three"),t=i(require("./MeshBVH.js")),r=i(require("./MeshBVHVisualizer.js")),n=require("./Constants.js"),s=require("./Utils/Debug.js"),u=require("./MeshBVHDebug.js");function i(e){return e&&e.__esModule?e:{default:e}}var o=new e.Ray,a=new e.Matrix4,c=e.Mesh.prototype.raycast;function f(e,t){if(this.geometry.boundsTree){if(void 0===this.material)return;if(a.copy(this.matrixWorld).invert(),o.copy(e.ray).applyMatrix4(a),!0===e.firstHitOnly){var r=this.geometry.boundsTree.raycastFirst(this,e,o);r&&t.push(r)}else this.geometry.boundsTree.raycast(this,e,o,t)}else c.call(this,e,t)}function p(e){return this.boundsTree=new t.default(this,e),this.boundsTree}function b(){this.boundsTree=null} },{"three":"dKqR","./MeshBVH.js":"nIyY","./MeshBVHVisualizer.js":"jNwr","./Constants.js":"tuIt","./Utils/Debug.js":"uNJb","./MeshBVHDebug.js":"HxoX"}],"ODc6":[function(require,module,exports) { -"use strict";var e=u(require("three")),n=d(require("stats.js")),r=require("dat.gui"),t=require("../src/workers/GenerateMeshBVHWorker.js"),a=require("../src/index.js"),o=d(require("../src/MeshBVHVisualizer.js")),i=d(require("../src/MeshBVH.js"));function d(e){return e&&e.__esModule?e:{default:e}}function s(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:n})(e)}function u(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=s(n);if(r&&r.has(e))return r.get(e);var t={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}return t.default=e,r&&r.set(e,t),t}e.Mesh.raycast=a.acceleratedRaycast;var l,p,w,c,m,f,h,g,y,v,b,M={useWebWorker:!0,radius:1,tube:.3,tubularSegments:250,radialSegments:250,p:3,q:5,displayHelper:!1,helperDepth:10},S=!1;function W(){h=document.getElementById("output"),(l=new e.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),l.setSize(window.innerWidth,window.innerHeight),l.setClearColor(16763432,1),l.gammaOutput=!0,document.body.appendChild(l.domElement),(w=new e.Scene).fog=new e.Fog(16763432,20,60);var a=new e.DirectionalLight(16777215,1);a.position.set(1,1,1),w.add(a),w.add(new e.AmbientLight(11583173,.8)),(p=new e.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,4),p.far=100,p.updateProjectionMatrix(),m=new e.Clock,v=new n.default,document.body.appendChild(v.dom),y=new e.Group,w.add(y);for(var o=0;o<400;o++){var i=new e.Mesh(new e.SphereBufferGeometry(1,32,32),new e.MeshBasicMaterial);i.position.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).multiplyScalar(70),i.scale.setScalar(.3*Math.random()+.1),y.add(i)}b=new t.GenerateMeshBVHWorker;var d=(f=new r.GUI).addFolder("helper");d.add(M,"displayHelper").name("enabled").onChange(function(e){e&&g&&g.update()}),d.add(M,"helperDepth",1,50,1).onChange(function(e){g&&(g.depth=e,g.update())}),d.open();var s=f.addFolder("knot");s.add(M,"useWebWorker"),s.add(M,"radius",.5,2,.01),s.add(M,"tube",.2,1.2,.01),s.add(M,"tubularSegments",50,1e3,1),s.add(M,"radialSegments",5,1e3,1),s.add(M,"p",1,10,1),s.add(M,"q",1,10,1),s.add({regenerateKnot:G},"regenerateKnot").name("regenerate"),s.open(),G(),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function G(){if(!S){S=!0,c&&(c.material.dispose(),c.geometry.dispose(),y.remove(c),y.remove(g));var n=window.performance.now(),r=window.performance.now();c=new e.Mesh(new e.TorusKnotBufferGeometry(M.radius,M.tube,M.tubularSegments,M.radialSegments,M.p,M.q),new e.MeshStandardMaterial({color:new e.Color(5093036).convertSRGBToLinear(),roughness:.75}));var t,a=window.performance.now()-r,d=window.performance.now();if(M.useWebWorker)b.generate(c.geometry).then(function(e){c.geometry.boundsTree=e,y.add(c);var n=window.performance.now()-d;S=!1,(g=new o.default(c,0)).depth=M.helperDepth,M.displayHelper&&g.update(),y.add(g),h.textContent="Geometry Generation Time : ".concat(a.toFixed(3),"ms\n")+"BVH Generation Time : ".concat(n.toFixed(3),"ms\n")+"Frame Stall Time : ".concat(t.toFixed(3))}),t=window.performance.now()-n;else{c.geometry.boundsTree=new i.default(c.geometry,{lazyGeneration:!1}),t=window.performance.now()-n,y.add(c);var s=window.performance.now()-d;S=!1,(g=new o.default(c)).depth=M.helperDepth,g.update(),y.add(g),h.textContent="Geometry Generation Time : ".concat(a.toFixed(3),"ms\n")+"BVH Generation Time : ".concat(s.toFixed(3),"ms\n")+"Frame Stall Time : ".concat(t.toFixed(3))}}}function x(){v.update(),requestAnimationFrame(x);var e=m.getDelta();y.rotation.x+=.4*e,y.rotation.y+=.6*e,g&&(g.visible=M.displayHelper),l.render(w,p)}W(),x(); +"use strict";var e=u(require("three")),n=d(require("stats.js")),r=require("dat.gui"),t=require("../src/workers/GenerateMeshBVHWorker.js"),a=require("../src/index.js"),o=d(require("../src/MeshBVHVisualizer.js")),i=d(require("../src/MeshBVH.js"));function d(e){return e&&e.__esModule?e:{default:e}}function s(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:n})(e)}function u(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=s(n);if(r&&r.has(e))return r.get(e);var t={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}return t.default=e,r&&r.set(e,t),t}e.Mesh.raycast=a.acceleratedRaycast;var p,w,l,c,m,f,h,g,y,v,b,M={useWebWorker:!0,radius:1,tube:.3,tubularSegments:250,radialSegments:250,p:3,q:5,displayHelper:!1,helperDepth:10},S=!1;function W(){h=document.getElementById("output"),(p=new e.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),p.setSize(window.innerWidth,window.innerHeight),p.setClearColor(16763432,1),p.gammaOutput=!0,document.body.appendChild(p.domElement),(l=new e.Scene).fog=new e.Fog(16763432,20,60);var a=new e.DirectionalLight(16777215,1);a.position.set(1,1,1),l.add(a),l.add(new e.AmbientLight(11583173,.8)),(w=new e.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,4),w.far=100,w.updateProjectionMatrix(),m=new e.Clock,v=new n.default,document.body.appendChild(v.dom),y=new e.Group,l.add(y);for(var o=0;o<400;o++){var i=new e.Mesh(new e.SphereBufferGeometry(1,32,32),new e.MeshBasicMaterial);i.position.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).multiplyScalar(70),i.scale.setScalar(.3*Math.random()+.1),y.add(i)}b=new t.GenerateMeshBVHWorker;var d=(f=new r.GUI).addFolder("helper");d.add(M,"displayHelper").name("enabled").onChange(function(e){e&&g&&g.update()}),d.add(M,"helperDepth",1,50,1).onChange(function(e){g&&(g.depth=e,g.update())}),d.open();var s=f.addFolder("knot");s.add(M,"useWebWorker"),s.add(M,"radius",.5,2,.01),s.add(M,"tube",.2,1.2,.01),s.add(M,"tubularSegments",50,1e3,1),s.add(M,"radialSegments",5,1e3,1),s.add(M,"p",1,10,1),s.add(M,"q",1,10,1),s.add({regenerateKnot:x},"regenerateKnot").name("regenerate"),s.open(),x(),window.addEventListener("resize",function(){w.aspect=window.innerWidth/window.innerHeight,w.updateProjectionMatrix(),p.setSize(window.innerWidth,window.innerHeight)},!1)}function x(){if(!S){S=!0,c&&(c.material.dispose(),c.geometry.dispose(),y.remove(c),y.remove(g));var n=window.performance.now(),r=window.performance.now();c=new e.Mesh(new e.TorusKnotBufferGeometry(M.radius,M.tube,M.tubularSegments,M.radialSegments,M.p,M.q),new e.MeshStandardMaterial({color:new e.Color(5093036).convertSRGBToLinear(),roughness:.75}));var t,a=window.performance.now()-r,d=window.performance.now();if(M.useWebWorker)b.generate(c.geometry).then(function(e){c.geometry.boundsTree=e,y.add(c);var n=window.performance.now()-d;S=!1,(g=new o.default(c,0)).depth=M.helperDepth,M.displayHelper&&g.update(),y.add(g),h.textContent="Geometry Generation Time : ".concat(a.toFixed(3),"ms\n")+"BVH Generation Time : ".concat(n.toFixed(3),"ms\n")+"Frame Stall Time : ".concat(t.toFixed(3))}),t=window.performance.now()-n;else{c.geometry.boundsTree=new i.default(c.geometry),t=window.performance.now()-n,y.add(c);var s=window.performance.now()-d;S=!1,(g=new o.default(c)).depth=M.helperDepth,g.update(),y.add(g),h.textContent="Geometry Generation Time : ".concat(a.toFixed(3),"ms\n")+"BVH Generation Time : ".concat(s.toFixed(3),"ms\n")+"Frame Stall Time : ".concat(t.toFixed(3))}}}function G(){v.update(),requestAnimationFrame(G);var e=m.getDelta();y.rotation.x+=.4*e,y.rotation.y+=.6*e,g&&(g.visible=M.displayHelper),p.render(l,w)}W(),G(); },{"three":"dKqR","stats.js":"dnrf","dat.gui":"KkZG","../src/workers/GenerateMeshBVHWorker.js":"dbR2","../src/index.js":"uBxZ","../src/MeshBVHVisualizer.js":"jNwr","../src/MeshBVH.js":"nIyY"}]},{},["ODc6"], null) \ No newline at end of file diff --git a/example/bundle/distancecast.4107d8f2.js b/example/bundle/distancecast.4107d8f2.js index 1e6a096af..29fcca497 100644 --- a/example/bundle/distancecast.4107d8f2.js +++ b/example/bundle/distancecast.4107d8f2.js @@ -579,5 +579,5 @@ var r;!function(){"use strict";var t=.5*(Math.sqrt(3)-1),e=(3-Math.sqrt(3))/6,a= var define; var t,r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(P){u=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof d?r:d,i=Object.create(o.prototype),a=new G(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return F()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=j(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:s,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(P){return{type:"throw",arg:P}}}t.wrap=h;var l="suspendedStart",s="suspendedYield",p="executing",y="completed",v={};function d(){}function g(){}function m(){}var w={};w[i]=function(){return this};var L=Object.getPrototypeOf,x=L&&L(L(N([])));x&&x!==e&&n.call(x,i)&&(w=x);var b=m.prototype=d.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(r){u(t,r,function(t){return this._invoke(r,t)})})}function _(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(l).then(function(t){h.value=t,a(h)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function j(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} },{}],"g6Fz":[function(require,module,exports) { -"use strict";require("core-js/modules/es6.array.copy-within.js"),require("core-js/modules/es6.array.fill.js"),require("core-js/modules/es6.array.filter.js"),require("core-js/modules/es6.array.find.js"),require("core-js/modules/es6.array.find-index.js"),require("core-js/modules/es7.array.flat-map.js"),require("core-js/modules/es6.array.from.js"),require("core-js/modules/es7.array.includes.js"),require("core-js/modules/es6.array.iterator.js"),require("core-js/modules/es6.array.map.js"),require("core-js/modules/es6.array.of.js"),require("core-js/modules/es6.array.slice.js"),require("core-js/modules/es6.array.sort.js"),require("core-js/modules/es6.array.species.js"),require("core-js/modules/es6.date.to-primitive.js"),require("core-js/modules/es6.function.has-instance.js"),require("core-js/modules/es6.function.name.js"),require("core-js/modules/es6.map.js"),require("core-js/modules/es6.math.acosh.js"),require("core-js/modules/es6.math.asinh.js"),require("core-js/modules/es6.math.atanh.js"),require("core-js/modules/es6.math.cbrt.js"),require("core-js/modules/es6.math.clz32.js"),require("core-js/modules/es6.math.cosh.js"),require("core-js/modules/es6.math.expm1.js"),require("core-js/modules/es6.math.fround.js"),require("core-js/modules/es6.math.hypot.js"),require("core-js/modules/es6.math.imul.js"),require("core-js/modules/es6.math.log1p.js"),require("core-js/modules/es6.math.log10.js"),require("core-js/modules/es6.math.log2.js"),require("core-js/modules/es6.math.sign.js"),require("core-js/modules/es6.math.sinh.js"),require("core-js/modules/es6.math.tanh.js"),require("core-js/modules/es6.math.trunc.js"),require("core-js/modules/es6.number.constructor.js"),require("core-js/modules/es6.number.epsilon.js"),require("core-js/modules/es6.number.is-finite.js"),require("core-js/modules/es6.number.is-integer.js"),require("core-js/modules/es6.number.is-nan.js"),require("core-js/modules/es6.number.is-safe-integer.js"),require("core-js/modules/es6.number.max-safe-integer.js"),require("core-js/modules/es6.number.min-safe-integer.js"),require("core-js/modules/es6.number.parse-float.js"),require("core-js/modules/es6.number.parse-int.js"),require("core-js/modules/es6.object.assign.js"),require("core-js/modules/es7.object.define-getter.js"),require("core-js/modules/es7.object.define-setter.js"),require("core-js/modules/es7.object.entries.js"),require("core-js/modules/es6.object.freeze.js"),require("core-js/modules/es6.object.get-own-property-descriptor.js"),require("core-js/modules/es7.object.get-own-property-descriptors.js"),require("core-js/modules/es6.object.get-own-property-names.js"),require("core-js/modules/es6.object.get-prototype-of.js"),require("core-js/modules/es7.object.lookup-getter.js"),require("core-js/modules/es7.object.lookup-setter.js"),require("core-js/modules/es6.object.prevent-extensions.js"),require("core-js/modules/es6.object.to-string.js"),require("core-js/modules/es6.object.is.js"),require("core-js/modules/es6.object.is-frozen.js"),require("core-js/modules/es6.object.is-sealed.js"),require("core-js/modules/es6.object.is-extensible.js"),require("core-js/modules/es6.object.keys.js"),require("core-js/modules/es6.object.seal.js"),require("core-js/modules/es7.object.values.js"),require("core-js/modules/es6.promise.js"),require("core-js/modules/es7.promise.finally.js"),require("core-js/modules/es6.reflect.apply.js"),require("core-js/modules/es6.reflect.construct.js"),require("core-js/modules/es6.reflect.define-property.js"),require("core-js/modules/es6.reflect.delete-property.js"),require("core-js/modules/es6.reflect.get.js"),require("core-js/modules/es6.reflect.get-own-property-descriptor.js"),require("core-js/modules/es6.reflect.get-prototype-of.js"),require("core-js/modules/es6.reflect.has.js"),require("core-js/modules/es6.reflect.is-extensible.js"),require("core-js/modules/es6.reflect.own-keys.js"),require("core-js/modules/es6.reflect.prevent-extensions.js"),require("core-js/modules/es6.reflect.set.js"),require("core-js/modules/es6.reflect.set-prototype-of.js"),require("core-js/modules/es6.regexp.constructor.js"),require("core-js/modules/es6.regexp.flags.js"),require("core-js/modules/es6.regexp.match.js"),require("core-js/modules/es6.regexp.replace.js"),require("core-js/modules/es6.regexp.split.js"),require("core-js/modules/es6.regexp.search.js"),require("core-js/modules/es6.regexp.to-string.js"),require("core-js/modules/es6.set.js"),require("core-js/modules/es6.symbol.js"),require("core-js/modules/es7.symbol.async-iterator.js"),require("core-js/modules/es6.string.anchor.js"),require("core-js/modules/es6.string.big.js"),require("core-js/modules/es6.string.blink.js"),require("core-js/modules/es6.string.bold.js"),require("core-js/modules/es6.string.code-point-at.js"),require("core-js/modules/es6.string.ends-with.js"),require("core-js/modules/es6.string.fixed.js"),require("core-js/modules/es6.string.fontcolor.js"),require("core-js/modules/es6.string.fontsize.js"),require("core-js/modules/es6.string.from-code-point.js"),require("core-js/modules/es6.string.includes.js"),require("core-js/modules/es6.string.italics.js"),require("core-js/modules/es6.string.iterator.js"),require("core-js/modules/es6.string.link.js"),require("core-js/modules/es7.string.pad-start.js"),require("core-js/modules/es7.string.pad-end.js"),require("core-js/modules/es6.string.raw.js"),require("core-js/modules/es6.string.repeat.js"),require("core-js/modules/es6.string.small.js"),require("core-js/modules/es6.string.starts-with.js"),require("core-js/modules/es6.string.strike.js"),require("core-js/modules/es6.string.sub.js"),require("core-js/modules/es6.string.sup.js"),require("core-js/modules/es7.string.trim-left.js"),require("core-js/modules/es7.string.trim-right.js"),require("core-js/modules/es6.typed.array-buffer.js"),require("core-js/modules/es6.typed.int8-array.js"),require("core-js/modules/es6.typed.uint8-array.js"),require("core-js/modules/es6.typed.uint8-clamped-array.js"),require("core-js/modules/es6.typed.int16-array.js"),require("core-js/modules/es6.typed.uint16-array.js"),require("core-js/modules/es6.typed.int32-array.js"),require("core-js/modules/es6.typed.uint32-array.js"),require("core-js/modules/es6.typed.float32-array.js"),require("core-js/modules/es6.typed.float64-array.js"),require("core-js/modules/es6.weak-map.js"),require("core-js/modules/es6.weak-set.js"),require("core-js/modules/web.timers.js"),require("core-js/modules/web.immediate.js"),require("core-js/modules/web.dom.iterable.js");var e=c(require("stats.js/src/Stats")),r=l(require("dat.gui")),s=l(require("three")),o=require("three/examples/jsm/controls/OrbitControls.js"),t=require("three/examples/jsm/controls/TransformControls.js"),i=require("three/examples/jsm/objects/MarchingCubes.js"),a=c(require("../src/MeshBVHVisualizer.js")),u=require("../src/index.js"),n=c(require("simplex-noise"));function d(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,s=new WeakMap;return(d=function(e){return e?s:r})(e)}function l(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var s=d(r);if(s&&s.has(e))return s.get(e);var o={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=t?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,s&&s.set(e,o),o}function c(e){return e&&e.__esModule?e:{default:e}}require("regenerator-runtime/runtime.js");var m=regeneratorRuntime.mark(I);s.Mesh.prototype.raycast=u.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=u.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=u.disposeBoundsTree;var j,p,q,h,f,y,g,w,b,v,x,M,S,k,B,C,P,z={visualizeBounds:!1,visualBoundsDepth:10,volume:{display:1,hideWhileGenerating:!1,alwaysShowDistance:!0,surfaceOnly:!1,distance:1,resolution:100,radius:4},displayClosestPoint:!0},W=!1;function G(){(h=new s.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),h.setSize(window.innerWidth,window.innerHeight),h.setClearColor(1251612,1),h.shadowMap.enabled=!0,h.shadowMap.type=s.PCFSoftShadowMap,document.body.appendChild(h.domElement),(p=new s.Scene).fog=new s.Fog(1251612,10,45);var a=new s.DirectionalLight(16777215,.5);a.position.set(20,20,20),a.castShadow=!0,a.shadow.mapSize.set(2048,2048);var u=a.shadow.camera;u.left=u.bottom=-15,u.right=u.top=15,u.updateProjectionMatrix(),p.add(a),p.add(new s.AmbientLight(14743546,.5));for(var d=new s.PlaneBufferGeometry(50,50,249,249),l=d.attributes.position,c=~~(100*Math.random()),m=new n.default(c),y=0;y<62500;y++){var G=l.getX(y)/15,T=l.getY(y)/15;l.setZ(y,3*m.noise2D(G,T))}d.computeVertexNormals(),d.computeBoundsTree({lazyGeneration:!1}),(g=new s.Mesh(d,new s.MeshStandardMaterial({color:16777215,metalness:.1,roughness:.9,side:s.DoubleSide}))).rotation.x=-Math.PI/2,g.position.y=-3,g.receiveShadow=!0,p.add(g),(q=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.z=5,q.far=100,q.updateProjectionMatrix(),j=new e.default,document.body.appendChild(j.dom);var I=new s.MeshStandardMaterial({roughness:.75,metalness:.1});w=new s.Group,p.add(w),(b=new s.Mesh(new s.CylinderBufferGeometry(.5,.25,1,20,1),I)).castShadow=!0,b.receiveShadow=!0,b.geometry.computeBoundsTree(),b.geometry.computeBoundingSphere(),w.add(b),f=new o.OrbitControls(q,h.domElement),(v=new t.TransformControls(q,h.domElement)).attach(w),v.addEventListener("dragging-changed",function(e){f.enabled=!e.value,e.value||(W=!0)}),v.addEventListener("objectChange",function(e){W=!0}),p.add(v);var E=new s.MeshStandardMaterial({color:15277667,metalness:0,roughness:.9,side:s.DoubleSide});(x=new i.MarchingCubes(100,E,!1,!1)).isolation=0;var A=new s.MeshStandardMaterial({flatShading:!0,color:15277667,metalness:0,roughness:.35,transparent:!0,depthWrite:!1,opacity:.15,premultipliedAlpha:!0});(M=new s.Mesh(void 0,A)).visible=!1,M.receiveShadow=!0;var F=A.clone();F.side=s.BackSide,(S=new s.Mesh(void 0,F)).receiveShadow=!0,S.visible=!1,(k=new s.Group).scale.multiplyScalar(5),k.add(x),k.add(S),k.add(M),p.add(k),(B=new s.Mesh(new s.SphereBufferGeometry(.025,20,20),new s.MeshBasicMaterial({color:15277667}))).castShadow=!0,p.add(B),(C=B.clone()).castShadow=!0,p.add(C);var R=new s.Mesh(new s.BoxBufferGeometry,B.material);R.castShadow=!0,R.position.z=.5,(P=new s.Object3D).add(R),p.add(P),p.updateMatrixWorld(!0);var H=new r.GUI({width:300});H.add(z,"visualizeBounds").onChange(function(){return O()}),H.add(z,"visualBoundsDepth").min(1).max(40).step(1).onChange(function(){return O()});var V=H.addFolder("distanceVisualization");V.add(z.volume,"display",{hide:0,"distance to terrain":1,"distance to mesh":2}).onChange(function(){return L=!0}),V.add(z.volume,"hideWhileGenerating"),V.add(z.volume,"alwaysShowDistance"),V.add(z.volume,"surfaceOnly").onChange(function(){return L=!0}),V.add(z.volume,"distance").min(0).max(2).step(.01).onChange(function(){return L=!0}),V.add(z.volume,"radius").min(1).max(20).onChange(function(){return L=!0}),V.add(z.volume,"resolution",5,200,1).onChange(function(){return L=!0}),V.open(),H.add(v,"mode",["translate","rotate"]);var _=H.addFolder("position");_.add(w.position,"x").min(-5).max(5).step(.001).listen(),_.add(w.position,"y").min(-5).max(5).step(.001).listen(),_.add(w.position,"z").min(-5).max(5).step(.001).listen();var N=H.addFolder("rotation");N.add(w.rotation,"x").min(-Math.PI).max(Math.PI).step(.001).listen(),N.add(w.rotation,"y").min(-Math.PI).max(Math.PI).step(.001).listen(),N.add(w.rotation,"z").min(-Math.PI).max(Math.PI).step(.001).listen(),H.open(),D(),window.addEventListener("resize",function(){q.aspect=window.innerWidth/window.innerHeight,q.updateProjectionMatrix(),h.setSize(window.innerWidth,window.innerHeight)},!1),window.addEventListener("keydown",function(e){switch(e.key){case"w":v.mode="translate";break;case"e":v.mode="rotate"}H.updateDisplay()})}function O(){y&&!z.visualizeBounds&&(p.remove(y),y=null),!y&&z.visualizeBounds&&(y=new a.default(g),p.add(y)),y&&(y.depth=z.visualBoundsDepth)}function D(e){w.updateMatrixWorld();var r=(new s.Matrix4).copy(g.matrixWorld).invert().multiply(w.matrixWorld),o=z.volume.distance,t=o,i=e?o:0,a=g.geometry.boundsTree.closestPointToGeometry(g,b.geometry,r,B.position,C.position,i,t)2)){c.x=e.clientX/window.innerWidth*2-1,c.y=-e.clientY/window.innerHeight*2+1,s.setFromCamera(c,p);var t=B();t.position.copy(p.position).addScaledVector(s.ray.direction,3),t.velocity.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).addScaledVector(s.ray.direction,10*Math.random()+15).multiplyScalar(.5)}}),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.createSphere=B}function z(){(new t.GLTFLoader).load("../models/low_poly_environment_jungle_scene/scene.gltf",function(t){(f=t.scene).scale.setScalar(.05);var a=new e.PointLight(65535);a.distance=7,a.position.set(-100,-40,100),f.add(a);var i=new e.PointLight(16768358);i.distance=15,i.intensity=5,i.position.set(80,80,135),i.shadow.normalBias=.01,i.shadow.bias=-.001,i.shadow.mapSize.setScalar(1024),i.castShadow=!0,f.add(i);var o=[];f.updateMatrixWorld(!0),f.traverse(function(e){if(e.geometry){var t=e.geometry.clone();for(var a in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==a&&t.deleteAttribute(a);o.push(t)}});var d=r.BufferGeometryUtils.mergeBufferGeometries(o,!1);d.boundsTree=new n.MeshBVH(d,{lazyGeneration:!1}),(w=new e.Mesh(d)).material.wireframe=!0,w.material.opacity=.5,w.material.transparent=!0,y=new n.MeshBVHVisualizer(w,S.visualizeDepth),u.add(y),u.add(w),u.add(f),f.traverse(function(e){e.material&&(e.castShadow=!0,e.receiveShadow=!0,e.material.shadowSide=2)})})}function C(t,a,r,i,o){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(oW.dot(v.velocity)?(F=.5*G*(H-E)/(H+E),q=.5*G*2*H/(H+E),F-=G):(F=.5*G*2*E/(H+E),q=.5*G*(E-H)/(H+E),q-=G),W.normalize(),p.velocity.addScaledVector(W,F),v.velocity.addScaledVector(W,q),x.copy(h.center).addScaledVector(b,-h.radius),C(p,v,x,b,G,0)}}p.position.copy(h.center)}}function O(){M.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),M.length=0,g.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),g.length=0}function W(){var t=new e.Vector3;M.forEach(function(e){t.copy(e.position),t.y+=10,t.normalize(),e.velocity.addScaledVector(t,120)})}function G(e){if(w)for(var t=S.physicsSteps,a=0;a=1&&(g.splice(r,1),o.parent.remove(o),o.geometry.dispose(),o.material.dispose(),r--,i--)}}function H(){v.update(),requestAnimationFrame(H);var e=Math.min(h.getDelta(),.1);w&&(w.visible=S.displayCollider,y.visible=S.displayBVH,S.pause||G(S.simulationSpeed*e)),l.render(u,p)}j(),H(); +"use strict";var e=c(require("three")),t=require("three/examples/jsm/loaders/GLTFLoader.js"),a=require("three/examples/jsm/controls/OrbitControls.js"),r=require("three/examples/jsm/utils/BufferGeometryUtils.js"),i=d(require("stats.js")),o=require("dat.gui"),n=require("../src/index.js");function d(e){return e&&e.__esModule?e:{default:e}}function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,a=new WeakMap;return(s=function(e){return e?a:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=s(t);if(a&&a.has(e))return a.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var n=i?Object.getOwnPropertyDescriptor(e,o):null;n&&(n.get||n.set)?Object.defineProperty(r,o,n):r[o]=e[o]}return r.default=e,a&&a.set(e,r),r}var l,p,u,h,m,v,f,w,y,S={displayCollider:!1,displayBVH:!1,visualizeDepth:10,gravity:-9.8,physicsSteps:5,simulationSpeed:1,sphereSize:1,pause:!1,step:function(){for(var e=S.physicsSteps,t=0;t2)){c.x=e.clientX/window.innerWidth*2-1,c.y=-e.clientY/window.innerHeight*2+1,s.setFromCamera(c,p);var t=B();t.position.copy(p.position).addScaledVector(s.ray.direction,3),t.velocity.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).addScaledVector(s.ray.direction,10*Math.random()+15).multiplyScalar(.5)}}),window.addEventListener("resize",function(){p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1),window.createSphere=B}function C(){(new t.GLTFLoader).load("../models/low_poly_environment_jungle_scene/scene.gltf",function(t){(f=t.scene).scale.setScalar(.05);var a=new e.PointLight(65535);a.distance=7,a.position.set(-100,-40,100),f.add(a);var i=new e.PointLight(16768358);i.distance=15,i.intensity=5,i.position.set(80,80,135),i.shadow.normalBias=.01,i.shadow.bias=-.001,i.shadow.mapSize.setScalar(1024),i.castShadow=!0,f.add(i);var o=[];f.updateMatrixWorld(!0),f.traverse(function(e){if(e.geometry){var t=e.geometry.clone();for(var a in t.applyMatrix4(e.matrixWorld),t.attributes)"position"!==a&&t.deleteAttribute(a);o.push(t)}});var d=r.BufferGeometryUtils.mergeBufferGeometries(o,!1);d.boundsTree=new n.MeshBVH(d),(w=new e.Mesh(d)).material.wireframe=!0,w.material.opacity=.5,w.material.transparent=!0,y=new n.MeshBVHVisualizer(w,S.visualizeDepth),u.add(y),u.add(w),u.add(f),f.traverse(function(e){e.material&&(e.castShadow=!0,e.receiveShadow=!0,e.material.shadowSide=2)})})}function z(t,a,r,i,o){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(oW.dot(v.velocity)?(G=.5*H*(E-F)/(E+F),q=.5*H*2*E/(E+F),G-=H):(G=.5*H*2*F/(E+F),q=.5*H*(F-E)/(E+F),q-=H),W.normalize(),p.velocity.addScaledVector(W,G),v.velocity.addScaledVector(W,q),x.copy(h.center).addScaledVector(b,-h.radius),z(p,v,x,b,H,0)}}p.position.copy(h.center)}}function O(){M.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),M.length=0,g.forEach(function(e){e.material.dispose(),e.geometry.dispose(),u.remove(e)}),g.length=0}function W(){var t=new e.Vector3;M.forEach(function(e){t.copy(e.position),t.y+=10,t.normalize(),e.velocity.addScaledVector(t,120)})}function H(e){if(w)for(var t=S.physicsSteps,a=0;a=1&&(g.splice(r,1),o.parent.remove(o),o.geometry.dispose(),o.material.dispose(),r--,i--)}}function E(){v.update(),requestAnimationFrame(E);var e=Math.min(h.getDelta(),.1);w&&(w.visible=S.displayCollider,y.visible=S.displayBVH,S.pause||H(S.simulationSpeed*e)),l.render(u,p)}j(),E(); },{"three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/utils/BufferGeometryUtils.js":"Jcll","stats.js":"dnrf","dat.gui":"KkZG","../src/index.js":"uBxZ"}]},{},["UoLN"], null) \ No newline at end of file diff --git a/example/bundle/pointCloudIntersection.fd058085.js b/example/bundle/pointCloudIntersection.fd058085.js index b6d67be15..d9989d783 100644 --- a/example/bundle/pointCloudIntersection.fd058085.js +++ b/example/bundle/pointCloudIntersection.fd058085.js @@ -45,5 +45,5 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel },{"three":"dKqR","./Utils/ArrayBoxUtilities.js":"a4zN"}],"uBxZ":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.acceleratedRaycast=f,exports.computeBoundsTree=p,exports.disposeBoundsTree=b,Object.defineProperty(exports,"MeshBVH",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"Visualizer",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"MeshBVHVisualizer",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"CENTER",{enumerable:!0,get:function(){return n.CENTER}}),Object.defineProperty(exports,"AVERAGE",{enumerable:!0,get:function(){return n.AVERAGE}}),Object.defineProperty(exports,"SAH",{enumerable:!0,get:function(){return n.SAH}}),Object.defineProperty(exports,"NOT_INTERSECTED",{enumerable:!0,get:function(){return n.NOT_INTERSECTED}}),Object.defineProperty(exports,"INTERSECTED",{enumerable:!0,get:function(){return n.INTERSECTED}}),Object.defineProperty(exports,"CONTAINED",{enumerable:!0,get:function(){return n.CONTAINED}}),Object.defineProperty(exports,"getBVHExtremes",{enumerable:!0,get:function(){return s.getBVHExtremes}}),Object.defineProperty(exports,"estimateMemoryInBytes",{enumerable:!0,get:function(){return s.estimateMemoryInBytes}}),Object.defineProperty(exports,"MeshBVHDebug",{enumerable:!0,get:function(){return u.MeshBVHDebug}});var e=require("three"),t=i(require("./MeshBVH.js")),r=i(require("./MeshBVHVisualizer.js")),n=require("./Constants.js"),s=require("./Utils/Debug.js"),u=require("./MeshBVHDebug.js");function i(e){return e&&e.__esModule?e:{default:e}}var o=new e.Ray,a=new e.Matrix4,c=e.Mesh.prototype.raycast;function f(e,t){if(this.geometry.boundsTree){if(void 0===this.material)return;if(a.copy(this.matrixWorld).invert(),o.copy(e.ray).applyMatrix4(a),!0===e.firstHitOnly){var r=this.geometry.boundsTree.raycastFirst(this,e,o);r&&t.push(r)}else this.geometry.boundsTree.raycast(this,e,o,t)}else c.call(this,e,t)}function p(e){return this.boundsTree=new t.default(this,e),this.boundsTree}function b(){this.boundsTree=null} },{"three":"dKqR","./MeshBVH.js":"nIyY","./MeshBVHVisualizer.js":"jNwr","./Constants.js":"tuIt","./Utils/Debug.js":"uNJb","./MeshBVHDebug.js":"HxoX"}],"CMV4":[function(require,module,exports) { -"use strict";var e,t,r,n,i,o,a,s,d=y(require("stats.js/src/Stats")),p=f(require("three")),c=require("three/examples/jsm/controls/OrbitControls.js"),l=require("three/examples/jsm/loaders/PLYLoader.js"),u=require("dat.gui"),w=require("../src/index.js");function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(h=function(e){return e?r:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=h(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function y(e){return e&&e.__esModule?e:{default:e}}p.Mesh.prototype.raycast=w.acceleratedRaycast,p.BufferGeometry.prototype.computeBoundsTree=w.computeBoundsTree,p.BufferGeometry.prototype.disposeBoundsTree=w.disposeBoundsTree;var m,v=new p.Vector2,T="../models/point_cloud_porsche_911_1.7M_vertices/scene.ply",b=new p.Raycaster,x={displayHelper:!1,helperDepth:10,pointSize:.005,raycastThreshold:.005,useBVH:!0};function M(){s=document.getElementById("output"),(n=new p.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),n.setSize(window.innerWidth,window.innerHeight),n.setClearColor(1251612,1),document.body.appendChild(n.domElement),t=new p.Scene,(r=new p.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(3,3,3),r.far=100,r.updateProjectionMatrix(),new c.OrbitControls(r,n.domElement),e=new d.default,document.body.appendChild(e.dom),window.addEventListener("resize",function(){r.aspect=window.innerWidth/window.innerHeight,r.updateProjectionMatrix(),n.setSize(window.innerWidth,window.innerHeight)},!1),(new l.PLYLoader).load(T,function(e){e.center();var r=new p.PointsMaterial({size:x.pointSize,vertexColors:!0});(a=new p.Points(e,r)).matrixAutoUpdate=!1,t.add(a);for(var n=[],s=e.clone(),d=0,c=s.attributes.position.count;dl?w.NOT_INTERSECTED:(e.expandByScalar(o),c.intersectsBox(e)?w.INTERSECTED:w.NOT_INTERSECTED)},intersectsTriangle:function(e){if(c.distanceSqToPoint(e.a)l?w.NOT_INTERSECTED:(e.expandByScalar(o),c.intersectsBox(e)?w.INTERSECTED:w.NOT_INTERSECTED)},intersectsTriangle:function(e){if(c.distanceSqToPoint(e.a)Math.PI&&(t-=s),n<-Math.PI?n+=s:n>Math.PI&&(n-=s),E.theta=t<=n?Math.max(t,Math.min(n,E.theta)):E.theta>(t+n)/2?Math.max(t,E.theta):Math.min(n,E.theta)),E.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,E.phi)),E.makeSafe(),E.radius*=O,E.radius=Math.max(u.minDistance,Math.min(u.maxDistance,E.radius)),!0===u.enableDamping?u.target.addScaledVector(g,u.dampingFactor):u.target.add(g),o.setFromSpherical(E),o.applyQuaternion(i),e.copy(u.target).add(o),u.object.lookAt(u.target),!0===u.enableDamping?(f.theta*=1-u.dampingFactor,f.phi*=1-u.dampingFactor,g.multiplyScalar(1-u.dampingFactor)):(f.set(0,0,0),g.set(0,0,0)),O=1,!!(v||r.distanceToSquared(u.object.position)>b||8*(1-c.dot(u.object.quaternion))>b)&&(u.dispatchEvent(l),r.copy(u.object.position),c.copy(u.object.quaternion),v=!1,!0)}),this.dispose=function(){u.domElement.removeEventListener("contextmenu",te),u.domElement.removeEventListener("pointerdown",B),u.domElement.removeEventListener("wheel",q),u.domElement.removeEventListener("touchstart",J),u.domElement.removeEventListener("touchend",ee),u.domElement.removeEventListener("touchmove",$),u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),null!==u._domElementKeyEvents&&u._domElementKeyEvents.removeEventListener("keydown",Q)};var u=this,l={type:"change"},m={type:"start"},p={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,b=1e-6,E=new e.Spherical,f=new e.Spherical,O=1,g=new e.Vector3,v=!1,T=new e.Vector2,y=new e.Vector2,P=new e.Vector2,L=new e.Vector2,w=new e.Vector2,A=new e.Vector2,N=new e.Vector2,M=new e.Vector2,j=new e.Vector2;function D(){return Math.pow(.95,u.zoomSpeed)}function R(e){f.theta-=e}function S(e){f.phi-=e}var k,C=(k=new e.Vector3,function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),g.add(k)}),Y=function(){var t=new e.Vector3;return function(e,n){!0===u.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(u.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),x=function(){var t=new e.Vector3;return function(e,n){var o=u.domElement;if(u.object.isPerspectiveCamera){var a=u.object.position;t.copy(a).sub(u.target);var i=t.length();i*=Math.tan(u.object.fov/2*Math.PI/180),C(2*e*i/o.clientHeight,u.object.matrix),Y(2*n*i/o.clientHeight,u.object.matrix)}else u.object.isOrthographicCamera?(C(e*(u.object.right-u.object.left)/u.object.zoom/o.clientWidth,u.object.matrix),Y(n*(u.object.top-u.object.bottom)/u.object.zoom/o.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),u.enablePan=!1)}}();function H(e){u.object.isPerspectiveCamera?O/=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom*e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function U(e){u.object.isPerspectiveCamera?O*=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom/e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function _(e){T.set(e.clientX,e.clientY)}function V(e){L.set(e.clientX,e.clientY)}function z(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,n)}}function I(e){if(1==e.touches.length)L.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);L.set(t,n)}}function X(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);N.set(0,o)}function F(e){if(1==e.touches.length)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var o=u.domElement;R(2*Math.PI*P.x/o.clientHeight),S(2*Math.PI*P.y/o.clientHeight),T.copy(y)}function Z(e){if(1==e.touches.length)w.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);w.set(t,n)}A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w)}function K(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);M.set(0,o),j.set(0,Math.pow(M.y/N.y,u.zoomSpeed)),H(j.y),N.copy(M)}function B(t){if(!1!==u.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var n;switch(t.preventDefault(),u.domElement.focus?u.domElement.focus():window.focus(),t.button){case 0:n=u.mouseButtons.LEFT;break;case 1:n=u.mouseButtons.MIDDLE;break;case 2:n=u.mouseButtons.RIGHT;break;default:n=-1}switch(n){case e.MOUSE.DOLLY:if(!1===u.enableZoom)return;!function(e){N.set(e.clientX,e.clientY)}(t),d=h.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enablePan)return;V(t),d=h.PAN}else{if(!1===u.enableRotate)return;_(t),d=h.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enableRotate)return;_(t),d=h.ROTATE}else{if(!1===u.enablePan)return;V(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(u.domElement.ownerDocument.addEventListener("pointermove",G),u.domElement.ownerDocument.addEventListener("pointerup",W),u.dispatchEvent(m))}(t)}}function G(e){if(!1!==u.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===u.enabled)return;switch(e.preventDefault(),d){case h.ROTATE:if(!1===u.enableRotate)return;!function(e){y.set(e.clientX,e.clientY),P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var t=u.domElement;R(2*Math.PI*P.x/t.clientHeight),S(2*Math.PI*P.y/t.clientHeight),T.copy(y),u.update()}(e);break;case h.DOLLY:if(!1===u.enableZoom)return;!function(e){M.set(e.clientX,e.clientY),j.subVectors(M,N),j.y>0?H(D()):j.y<0&&U(D()),N.copy(M),u.update()}(e);break;case h.PAN:if(!1===u.enablePan)return;!function(e){w.set(e.clientX,e.clientY),A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w),u.update()}(e)}}(e)}}function W(e){switch(e.pointerType){case"mouse":case"pen":!function(e){if(u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),!1===u.enabled)return;u.dispatchEvent(p),d=h.NONE}()}}function q(e){!1===u.enabled||!1===u.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),u.dispatchEvent(m),function(e){e.deltaY<0?U(D()):e.deltaY>0&&H(D()),u.update()}(e),u.dispatchEvent(p))}function Q(e){!1!==u.enabled&&!1!==u.enablePan&&function(e){var t=!1;switch(e.keyCode){case u.keys.UP:x(0,u.keyPanSpeed),t=!0;break;case u.keys.BOTTOM:x(0,-u.keyPanSpeed),t=!0;break;case u.keys.LEFT:x(u.keyPanSpeed,0),t=!0;break;case u.keys.RIGHT:x(-u.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),u.update())}(e)}function J(t){if(!1!==u.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(u.touches.ONE){case e.TOUCH.ROTATE:if(!1===u.enableRotate)return;z(t),d=h.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===u.enablePan)return;I(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(u.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&X(e),u.enablePan&&I(e)}(t),d=h.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&X(e),u.enableRotate&&z(e)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&u.dispatchEvent(m)}}function $(e){if(!1!==u.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===u.enableRotate)return;F(e),u.update();break;case h.TOUCH_PAN:if(!1===u.enablePan)return;Z(e),u.update();break;case h.TOUCH_DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&K(e),u.enablePan&&Z(e)}(e),u.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&K(e),u.enableRotate&&F(e)}(e),u.update();break;default:d=h.NONE}}function ee(e){!1!==u.enabled&&(u.dispatchEvent(p),d=h.NONE)}function te(e){!1!==u.enabled&&e.preventDefault()}u.domElement.addEventListener("contextmenu",te),u.domElement.addEventListener("pointerdown",B),u.domElement.addEventListener("wheel",q),u.domElement.addEventListener("touchstart",J),u.domElement.addEventListener("touchend",ee),u.domElement.addEventListener("touchmove",$),this.update()};exports.OrbitControls=t,t.prototype=Object.create(e.EventDispatcher.prototype),t.prototype.constructor=t;var n=function(n,o){t.call(this,n,o),this.screenSpacePanning=!1,this.mouseButtons.LEFT=e.MOUSE.PAN,this.mouseButtons.RIGHT=e.MOUSE.ROTATE,this.touches.ONE=e.TOUCH.PAN,this.touches.TWO=e.TOUCH.DOLLY_ROTATE};exports.MapControls=n,n.prototype=Object.create(e.EventDispatcher.prototype),n.prototype.constructor=n; },{"../../../build/three.module.js":"dKqR"}],"OLLT":[function(require,module,exports) { -"use strict";var e,t,r,n=c(require("three")),o=require("../src/index.js"),i=s(require("../src/MeshBVHVisualizer.js")),a=require("three/examples/jsm/controls/OrbitControls.js");function s(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}n.Mesh.prototype.raycast=o.acceleratedRaycast,n.BufferGeometry.prototype.computeBoundsTree=o.computeBoundsTree,n.BufferGeometry.prototype.disposeBoundsTree=o.disposeBoundsTree;var u=[],l=null;function p(){if(null===l)throw new Error;return(l=(1103515245*l+12345)%2e31)/2e31}function w(){(e=new n.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1118481,1),e.gammaOutput=!0,document.body.appendChild(e.domElement),r=new n.Scene;var s=new n.DirectionalLight(16777215,1);s.position.set(1,1,1),r.add(s),r.add(new n.AmbientLight(11583173,.8)),(t=new n.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,4),t.far=100,t.updateProjectionMatrix(),new a.OrbitControls(t,e.domElement);var d={strategy:o.AVERAGE,packData:!1,lazyGeneration:!1,maxDepth:1},c=new n.TorusBufferGeometry(1,1,40,10);c.computeBoundsTree(d),l=7830035629,p();for(var w=0;w<10;w++){var f=new n.Mesh(c,new n.MeshStandardMaterial);if(f.rotation.x=10*p(),f.rotation.y=10*p(),f.rotation.z=10*p(),f.position.x=p(),f.position.y=p(),f.position.z=p(),2===w){u.push(f),r.add(f);var y=f.clone();y.material=new n.MeshBasicMaterial({wireframe:!0,color:16737894}),r.add(y);var m=new i.default(f,10);r.add(m)}f.updateMatrix(!0),f.updateMatrixWorld(!0)}l=4697211981,p();var h=new n.Raycaster;h.firstHitOnly=!1,h.ray.origin.set(10*p(),10*p(),10*p()),h.ray.direction.copy(h.ray.origin).multiplyScalar(-1).normalize();var v=new n.SphereBufferGeometry(.1),g=new n.Mesh(v);g.position.copy(h.ray.at(0)),r.add(g);var M=h.intersectObjects(u,!0);h.firstHitOnly=!0;var O=h.intersectObjects(u,!0);c.boundsTree=null;var b=h.intersectObjects(u,!0);console.log("FIRST HIT",O),console.log("BVH HITS",M),console.log("OG HITS",b);var j=g.clone();j.position.copy(O[0].point),r.add(j);var B=g.clone();B.position.copy(M[0].point),r.add(B);var x=new n.Line;x.geometry.setFromPoints([h.ray.at(0,new n.Vector3),h.ray.at(20,new n.Vector3)]),r.add(x),window.addEventListener("resize",function(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}function f(){requestAnimationFrame(f),e.render(r,t)}w(),f(); +"use strict";var e,t,r,n=c(require("three")),o=require("../src/index.js"),i=s(require("../src/MeshBVHVisualizer.js")),a=require("three/examples/jsm/controls/OrbitControls.js");function s(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}n.Mesh.prototype.raycast=o.acceleratedRaycast,n.BufferGeometry.prototype.computeBoundsTree=o.computeBoundsTree,n.BufferGeometry.prototype.disposeBoundsTree=o.disposeBoundsTree;var u=[],l=null;function p(){if(null===l)throw new Error;return(l=(1103515245*l+12345)%2e31)/2e31}function w(){(e=new n.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),e.setSize(window.innerWidth,window.innerHeight),e.setClearColor(1118481,1),e.gammaOutput=!0,document.body.appendChild(e.domElement),r=new n.Scene;var s=new n.DirectionalLight(16777215,1);s.position.set(1,1,1),r.add(s),r.add(new n.AmbientLight(11583173,.8)),(t=new n.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(0,0,4),t.far=100,t.updateProjectionMatrix(),new a.OrbitControls(t,e.domElement);var d={strategy:o.AVERAGE,packData:!1,maxDepth:1},c=new n.TorusBufferGeometry(1,1,40,10);c.computeBoundsTree(d),l=7830035629,p();for(var w=0;w<10;w++){var f=new n.Mesh(c,new n.MeshStandardMaterial);if(f.rotation.x=10*p(),f.rotation.y=10*p(),f.rotation.z=10*p(),f.position.x=p(),f.position.y=p(),f.position.z=p(),2===w){u.push(f),r.add(f);var y=f.clone();y.material=new n.MeshBasicMaterial({wireframe:!0,color:16737894}),r.add(y);var m=new i.default(f,10);r.add(m)}f.updateMatrix(!0),f.updateMatrixWorld(!0)}l=4697211981,p();var h=new n.Raycaster;h.firstHitOnly=!1,h.ray.origin.set(10*p(),10*p(),10*p()),h.ray.direction.copy(h.ray.origin).multiplyScalar(-1).normalize();var v=new n.SphereBufferGeometry(.1),g=new n.Mesh(v);g.position.copy(h.ray.at(0)),r.add(g);var M=h.intersectObjects(u,!0);h.firstHitOnly=!0;var O=h.intersectObjects(u,!0);c.boundsTree=null;var b=h.intersectObjects(u,!0);console.log("FIRST HIT",O),console.log("BVH HITS",M),console.log("OG HITS",b);var j=g.clone();j.position.copy(O[0].point),r.add(j);var B=g.clone();B.position.copy(M[0].point),r.add(B);var x=new n.Line;x.geometry.setFromPoints([h.ray.at(0,new n.Vector3),h.ray.at(20,new n.Vector3)]),r.add(x),window.addEventListener("resize",function(){t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix(),e.setSize(window.innerWidth,window.innerHeight)},!1)}function f(){requestAnimationFrame(f),e.render(r,t)}w(),f(); },{"three":"dKqR","../src/index.js":"uBxZ","../src/MeshBVHVisualizer.js":"jNwr","three/examples/jsm/controls/OrbitControls.js":"xTGv"}]},{},["OLLT"], null) \ No newline at end of file diff --git a/example/bundle/raycast.88074831.js b/example/bundle/raycast.88074831.js index cd70e4c0f..679d80038 100644 --- a/example/bundle/raycast.88074831.js +++ b/example/bundle/raycast.88074831.js @@ -571,5 +571,5 @@ var e;!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module var define; var t,r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(P){u=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof d?r:d,i=Object.create(o.prototype),a=new G(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return F()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=j(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:s,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(P){return{type:"throw",arg:P}}}t.wrap=h;var l="suspendedStart",s="suspendedYield",p="executing",y="completed",v={};function d(){}function g(){}function m(){}var w={};w[i]=function(){return this};var L=Object.getPrototypeOf,x=L&&L(L(N([])));x&&x!==e&&n.call(x,i)&&(w=x);var b=m.prototype=d.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(r){u(t,r,function(t){return this._invoke(r,t)})})}function _(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(l).then(function(t){h.value=t,a(h)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function j(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)} },{}],"H4B8":[function(require,module,exports) { -"use strict";require("core-js/modules/es6.array.copy-within.js"),require("core-js/modules/es6.array.fill.js"),require("core-js/modules/es6.array.filter.js"),require("core-js/modules/es6.array.find.js"),require("core-js/modules/es6.array.find-index.js"),require("core-js/modules/es7.array.flat-map.js"),require("core-js/modules/es6.array.from.js"),require("core-js/modules/es7.array.includes.js"),require("core-js/modules/es6.array.iterator.js"),require("core-js/modules/es6.array.map.js"),require("core-js/modules/es6.array.of.js"),require("core-js/modules/es6.array.slice.js"),require("core-js/modules/es6.array.sort.js"),require("core-js/modules/es6.array.species.js"),require("core-js/modules/es6.date.to-primitive.js"),require("core-js/modules/es6.function.has-instance.js"),require("core-js/modules/es6.function.name.js"),require("core-js/modules/es6.map.js"),require("core-js/modules/es6.math.acosh.js"),require("core-js/modules/es6.math.asinh.js"),require("core-js/modules/es6.math.atanh.js"),require("core-js/modules/es6.math.cbrt.js"),require("core-js/modules/es6.math.clz32.js"),require("core-js/modules/es6.math.cosh.js"),require("core-js/modules/es6.math.expm1.js"),require("core-js/modules/es6.math.fround.js"),require("core-js/modules/es6.math.hypot.js"),require("core-js/modules/es6.math.imul.js"),require("core-js/modules/es6.math.log1p.js"),require("core-js/modules/es6.math.log10.js"),require("core-js/modules/es6.math.log2.js"),require("core-js/modules/es6.math.sign.js"),require("core-js/modules/es6.math.sinh.js"),require("core-js/modules/es6.math.tanh.js"),require("core-js/modules/es6.math.trunc.js"),require("core-js/modules/es6.number.constructor.js"),require("core-js/modules/es6.number.epsilon.js"),require("core-js/modules/es6.number.is-finite.js"),require("core-js/modules/es6.number.is-integer.js"),require("core-js/modules/es6.number.is-nan.js"),require("core-js/modules/es6.number.is-safe-integer.js"),require("core-js/modules/es6.number.max-safe-integer.js"),require("core-js/modules/es6.number.min-safe-integer.js"),require("core-js/modules/es6.number.parse-float.js"),require("core-js/modules/es6.number.parse-int.js"),require("core-js/modules/es6.object.assign.js"),require("core-js/modules/es7.object.define-getter.js"),require("core-js/modules/es7.object.define-setter.js"),require("core-js/modules/es7.object.entries.js"),require("core-js/modules/es6.object.freeze.js"),require("core-js/modules/es6.object.get-own-property-descriptor.js"),require("core-js/modules/es7.object.get-own-property-descriptors.js"),require("core-js/modules/es6.object.get-own-property-names.js"),require("core-js/modules/es6.object.get-prototype-of.js"),require("core-js/modules/es7.object.lookup-getter.js"),require("core-js/modules/es7.object.lookup-setter.js"),require("core-js/modules/es6.object.prevent-extensions.js"),require("core-js/modules/es6.object.to-string.js"),require("core-js/modules/es6.object.is.js"),require("core-js/modules/es6.object.is-frozen.js"),require("core-js/modules/es6.object.is-sealed.js"),require("core-js/modules/es6.object.is-extensible.js"),require("core-js/modules/es6.object.keys.js"),require("core-js/modules/es6.object.seal.js"),require("core-js/modules/es7.object.values.js"),require("core-js/modules/es6.promise.js"),require("core-js/modules/es7.promise.finally.js"),require("core-js/modules/es6.reflect.apply.js"),require("core-js/modules/es6.reflect.construct.js"),require("core-js/modules/es6.reflect.define-property.js"),require("core-js/modules/es6.reflect.delete-property.js"),require("core-js/modules/es6.reflect.get.js"),require("core-js/modules/es6.reflect.get-own-property-descriptor.js"),require("core-js/modules/es6.reflect.get-prototype-of.js"),require("core-js/modules/es6.reflect.has.js"),require("core-js/modules/es6.reflect.is-extensible.js"),require("core-js/modules/es6.reflect.own-keys.js"),require("core-js/modules/es6.reflect.prevent-extensions.js"),require("core-js/modules/es6.reflect.set.js"),require("core-js/modules/es6.reflect.set-prototype-of.js"),require("core-js/modules/es6.regexp.constructor.js"),require("core-js/modules/es6.regexp.flags.js"),require("core-js/modules/es6.regexp.match.js"),require("core-js/modules/es6.regexp.replace.js"),require("core-js/modules/es6.regexp.split.js"),require("core-js/modules/es6.regexp.search.js"),require("core-js/modules/es6.regexp.to-string.js"),require("core-js/modules/es6.set.js"),require("core-js/modules/es6.symbol.js"),require("core-js/modules/es7.symbol.async-iterator.js"),require("core-js/modules/es6.string.anchor.js"),require("core-js/modules/es6.string.big.js"),require("core-js/modules/es6.string.blink.js"),require("core-js/modules/es6.string.bold.js"),require("core-js/modules/es6.string.code-point-at.js"),require("core-js/modules/es6.string.ends-with.js"),require("core-js/modules/es6.string.fixed.js"),require("core-js/modules/es6.string.fontcolor.js"),require("core-js/modules/es6.string.fontsize.js"),require("core-js/modules/es6.string.from-code-point.js"),require("core-js/modules/es6.string.includes.js"),require("core-js/modules/es6.string.italics.js"),require("core-js/modules/es6.string.iterator.js"),require("core-js/modules/es6.string.link.js"),require("core-js/modules/es7.string.pad-start.js"),require("core-js/modules/es7.string.pad-end.js"),require("core-js/modules/es6.string.raw.js"),require("core-js/modules/es6.string.repeat.js"),require("core-js/modules/es6.string.small.js"),require("core-js/modules/es6.string.starts-with.js"),require("core-js/modules/es6.string.strike.js"),require("core-js/modules/es6.string.sub.js"),require("core-js/modules/es6.string.sup.js"),require("core-js/modules/es7.string.trim-left.js"),require("core-js/modules/es7.string.trim-right.js"),require("core-js/modules/es6.typed.array-buffer.js"),require("core-js/modules/es6.typed.int8-array.js"),require("core-js/modules/es6.typed.uint8-array.js"),require("core-js/modules/es6.typed.uint8-clamped-array.js"),require("core-js/modules/es6.typed.int16-array.js"),require("core-js/modules/es6.typed.uint16-array.js"),require("core-js/modules/es6.typed.int32-array.js"),require("core-js/modules/es6.typed.uint32-array.js"),require("core-js/modules/es6.typed.float32-array.js"),require("core-js/modules/es6.typed.float64-array.js"),require("core-js/modules/es6.weak-map.js"),require("core-js/modules/es6.weak-set.js"),require("core-js/modules/web.timers.js"),require("core-js/modules/web.immediate.js"),require("core-js/modules/web.dom.iterable.js");var e=n(require("stats.js")),r=u(require("dat.gui")),s=u(require("three")),o=n(require("../src/MeshBVHVisualizer.js")),t=require("../src/index.js");function i(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,s=new WeakMap;return(i=function(e){return e?s:r})(e)}function u(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var s=i(r);if(s&&s.has(e))return s.get(e);var o={},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var n=t?Object.getOwnPropertyDescriptor(e,u):null;n&&(n.get||n.set)?Object.defineProperty(o,u,n):o[u]=e[u]}return o.default=e,s&&s.set(e,o),o}function n(e){return e&&e.__esModule?e:{default:e}}require("regenerator-runtime/runtime.js"),s.Mesh.prototype.raycast=t.acceleratedRaycast,s.BufferGeometry.prototype.computeBoundsTree=t.computeBoundsTree,s.BufferGeometry.prototype.disposeBoundsTree=t.disposeBoundsTree;var a=1251612,d=new s.WebGLRenderer({antialias:!0});d.setPixelRatio(window.devicePixelRatio),d.setSize(window.innerWidth,window.innerHeight),d.setClearColor(a,1),document.body.appendChild(d.domElement);var c=new s.Scene;c.fog=new s.Fog(1251612,20,60);var j=new s.DirectionalLight(16777215,.5);j.position.set(1,1,1),c.add(j),c.add(new s.AmbientLight(16777215,.4));var l=1,m=.4,p=400,q=100,h=null,y=new s.Object3D,f=new s.TorusKnotBufferGeometry(l,m,p,q),g=new s.MeshPhongMaterial({color:15277667});y.scale.multiplyScalar(10),c.add(y);var w=new s.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50);w.position.z=40,w.far=100,w.updateProjectionMatrix();var b=new e.default;document.body.appendChild(b.dom);var v=[],x=new s.Raycaster,M=new s.SphereGeometry(.25,20,20),B=new s.CylinderGeometry(.02,.02),T=25,z=[],S={raycasters:{count:150,speed:1},mesh:{splitStrategy:t.CENTER,lazyGeneration:!0,count:1,useBoundsTree:!0,visualizeBounds:!1,speed:1,visualBoundsDepth:10}},C=null,E=0,P=function(){var e=new s.Mesh(f,g);e.rotation.x=10*Math.random(),e.rotation.y=10*Math.random(),z.push(e),y.add(e)},G=function(){var e=new s.Object3D,r=new s.MeshBasicMaterial({color:16777215}),o=new s.Mesh(M,r),t=new s.Mesh(M,r);t.scale.multiplyScalar(.5);var i=new s.Mesh(B,new s.MeshBasicMaterial({color:16777215,transparent:!0,opacity:.25}));e.add(i),e.add(o),e.add(t),c.add(e),o.position.set(T,0,0),e.rotation.x=10*Math.random(),e.rotation.y=10*Math.random();var u=new s.Vector3,n=new s.Vector3,a=Math.random()-.5,d=Math.random()-.5;v.push({update:function(){e.rotation.x+=1e-4*a*S.raycasters.speed*E,e.rotation.y+=1e-4*d*S.raycasters.speed*E,o.updateMatrixWorld(),u.setFromMatrixPosition(o.matrixWorld),n.copy(u).multiplyScalar(-1).normalize(),x.set(u,n),x.firstHitOnly=!0;var r=x.intersectObject(y,!0),s=r.length?r[0].distance:T;t.position.set(T-s,0,0),i.position.set(T-s/2,0,0),i.scale.set(1,s,1),i.rotation.z=Math.PI/2},remove:function(){c.remove(e)}})},k=function(){for(;v.length>S.raycasters.count;)v.pop().remove();for(;v.lengthS.mesh.count;)y.remove(z.pop());for(;z.lengthE.raycasters.count;)v.pop().remove();for(;v.lengthE.mesh.count;)y.remove(S.pop());for(;S.length=3||Math.abs(r-D)>=3){var a=3*(b.length/3-1),i=!1;if(b.length>3)H.set(b[a-3],b[a-3+1]),P.set(b[a],b[a+1]),P.sub(H).normalize(),H.set(b[a],b[a+1]),N.set(n,o),N.sub(H).normalize(),i=P.dot(N)>.99;i?(b[a]=n,b[a+1]=o):b.push(n,o,0),T=!0,h.visible=!0,W=t,D=r,x.liveUpdate&&(O=!0)}}}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function B(){if(p.update(),requestAnimationFrame(B),y.material.wireframe=x.wireframe,w.visible=x.displayHelper,T){if("lasso"===x.toolMode){var t=b.length;b.push(b[0],b[1],b[2]),h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1)),b.length=t}else h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1));h.frustumCulled=!1,T=!1}O&&(O=!1,b.length>0&&H());var r=Math.tan(e.MathUtils.DEG2RAD*s.fov/2)*h.position.z;h.scale.set(-r*s.aspect,-r,1),l.render(u,s),x.rotate&&(M.rotation.y+=.01,x.liveUpdate&&E&&(O=!0))}S(),B();var C=new e.Matrix4,R=new Array(8).fill().map(function(){return new e.Vector3}),A=new Array(12).fill().map(function(){return new e.Line3}),W=[],D=[];function H(){for(C.copy(y.matrixWorld).premultiply(s.matrixWorldInverse).premultiply(s.projectionMatrix);W.lengths&&(s=h.y),h.xs)||!(T>s))b0?1:2}function r(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)}for(var n=1/0,o=-1,a=0,i=e.length;a=r(l,e)?-1:1:2==o?-1:1})).length,c=1;cl&&d>s)return!1;if(du&&i>c)return!1;if(in.end.y,a=0,i=t.length;ad.end.y;N(e,d,o,l)&&r++,o=l}return r}function j(e,t){function r(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}var n=e.start,o=e.end,a=t.start,i=t.end;return r(n,a,i)!==r(o,a,i)&&r(n,o,a)!==r(n,o,i)} +"use strict";var e=d(require("three")),t=a(require("stats.js")),r=require("dat.gui"),n=require("three/examples/jsm/controls/OrbitControls.js"),o=require("../src/index.js");function a(e){return e&&e.__esModule?e:{default:e}}function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var d=o?Object.getOwnPropertyDescriptor(e,a):null;d&&(d.get||d.set)?Object.defineProperty(n,a,d):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}var l,s,u,c,p,f,h,y,w,v,m,g,M,x={toolMode:"lasso",selectionMode:"intersection",liveUpdate:!1,selectModel:!1,wireframe:!1,useBoundsTree:!0,displayHelper:!1,helperDepth:10,rotate:!0},b=[],E=!1,T=!1,O=!1;function S(){g=document.getElementById("output");var a=new e.Color(2503224);(l=new e.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),l.setSize(window.innerWidth,window.innerHeight),l.setClearColor(a,1),l.shadowMap.enabled=!0,l.gammaOutput=!0,document.body.appendChild(l.domElement),u=new e.Scene;var i=new e.DirectionalLight(16777215,1);i.castShadow=!0,i.shadow.mapSize.set(2048,2048),i.position.set(10,10,10),u.add(i),u.add(new e.AmbientLight(11583173,.8)),(s=new e.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,50)).position.set(2,4,6),s.far=100,s.updateProjectionMatrix(),u.add(s),(h=new e.Line).material.color.set(16750592).convertSRGBToLinear(),h.renderOrder=1,h.position.z=-.2,h.depthTest=!1,h.scale.setScalar(1),s.add(h),M=new e.Group,u.add(M),(y=new e.Mesh(new e.TorusKnotBufferGeometry(1.5,.5,500,60).toNonIndexed(),new e.MeshStandardMaterial({polygonOffset:!0,polygonOffsetFactor:1}))).geometry.boundsTree=new o.MeshBVH(y.geometry),y.geometry.setAttribute("color",new e.Uint8BufferAttribute(new Array(3*y.geometry.index.count).fill(255),3,!0)),y.castShadow=!0,y.receiveShadow=!0,M.add(y),w=new o.MeshBVHVisualizer(y,10),M.add(w),(v=new e.Mesh).geometry=y.geometry.clone(),v.geometry.drawRange.count=0,v.material=new e.MeshBasicMaterial({opacity:.05,transparent:!0,depthWrite:!1}),v.material.color.set(16750592).convertSRGBToLinear(),v.renderOrder=1,M.add(v),(m=new e.Mesh).geometry=v.geometry,m.material=new e.MeshBasicMaterial({opacity:.25,transparent:!0,wireframe:!0,depthWrite:!1}),m.material.color.copy(v.material.color),m.renderOrder=2,M.add(m);var d=new e.GridHelper(10,10,16777215,16777215);d.material.opacity=.2,d.material.transparent=!0,d.position.y=-2.75,u.add(d);var S=new e.Mesh(new e.PlaneBufferGeometry,new e.ShadowMaterial({color:0,opacity:.2,depthWrite:!1}));S.position.y=-2.74,S.rotation.x=-Math.PI/2,S.scale.setScalar(20),S.renderOrder=2,S.receiveShadow=!0,u.add(S),p=new t.default,document.body.appendChild(p.dom),(f=new n.OrbitControls(s,l.domElement)).minDistance=3,f.touches.ONE=e.TOUCH.PAN,f.mouseButtons.LEFT=e.MOUSE.PAN,f.touches.TWO=e.TOUCH.ROTATE,f.mouseButtons.RIGHT=e.MOUSE.ROTATE,f.enablePan=!1;var B=(c=new r.GUI).addFolder("selection");B.add(x,"toolMode",["lasso","box"]),B.add(x,"selectionMode",["centroid","intersection"]),B.add(x,"selectModel"),B.add(x,"liveUpdate"),B.add(x,"useBoundsTree"),B.open();var C=c.addFolder("display");C.add(x,"wireframe"),C.add(x,"rotate"),C.add(x,"displayHelper"),C.add(x,"helperDepth",1,30,1).onChange(function(e){w.depth=e,w.update()}),C.open(),c.open();var R=-1/0,A=-1/0,W=-1/0,D=-1/0,H=new e.Vector2,P=new e.Vector2,N=new e.Vector2;l.domElement.addEventListener("pointerdown",function(e){W=e.clientX,D=e.clientY,R=e.clientX/window.innerWidth*2-1,A=-(e.clientY/window.innerHeight*2-1),b.length=0,E=!0}),l.domElement.addEventListener("pointerup",function(){h.visible=!1,E=!1,b.length&&(O=!0)}),l.domElement.addEventListener("pointermove",function(e){if(0!=(1&e.buttons)){var t=e.clientX,r=e.clientY,n=e.clientX/window.innerWidth*2-1,o=-(e.clientY/window.innerHeight*2-1);if("box"===x.toolMode)b.length=15,b[0]=R,b[1]=A,b[2]=0,b[3]=n,b[4]=A,b[5]=0,b[6]=n,b[7]=o,b[8]=0,b[9]=R,b[10]=o,b[11]=0,b[12]=R,b[13]=A,b[14]=0,t===W&&r===D||(T=!0),W=t,D=r,h.visible=!0,x.liveUpdate&&(O=!0);else if(Math.abs(t-W)>=3||Math.abs(r-D)>=3){var a=3*(b.length/3-1),i=!1;if(b.length>3)H.set(b[a-3],b[a-3+1]),P.set(b[a],b[a+1]),P.sub(H).normalize(),H.set(b[a],b[a+1]),N.set(n,o),N.sub(H).normalize(),i=P.dot(N)>.99;i?(b[a]=n,b[a+1]=o):b.push(n,o,0),T=!0,h.visible=!0,W=t,D=r,x.liveUpdate&&(O=!0)}}}),window.addEventListener("resize",function(){s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight)},!1)}function B(){if(p.update(),requestAnimationFrame(B),y.material.wireframe=x.wireframe,w.visible=x.displayHelper,T){if("lasso"===x.toolMode){var t=b.length;b.push(b[0],b[1],b[2]),h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1)),b.length=t}else h.geometry.setAttribute("position",new e.Float32BufferAttribute(b,3,!1));h.frustumCulled=!1,T=!1}O&&(O=!1,b.length>0&&H());var r=Math.tan(e.MathUtils.DEG2RAD*s.fov/2)*h.position.z;h.scale.set(-r*s.aspect,-r,1),l.render(u,s),x.rotate&&(M.rotation.y+=.01,x.liveUpdate&&E&&(O=!0))}S(),B();var C=new e.Matrix4,R=new Array(8).fill().map(function(){return new e.Vector3}),A=new Array(12).fill().map(function(){return new e.Line3}),W=[],D=[];function H(){for(C.copy(y.matrixWorld).premultiply(s.matrixWorldInverse).premultiply(s.projectionMatrix);W.lengths&&(s=h.y),h.xs)||!(T>s))b0?1:2}function r(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)}for(var n=1/0,o=-1,a=0,i=e.length;a=r(l,e)?-1:1:2==o?-1:1})).length,c=1;cl&&d>s)return!1;if(du&&i>c)return!1;if(in.end.y,a=0,i=t.length;ad.end.y;N(e,d,o,l)&&r++,o=l}return r}function j(e,t){function r(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}var n=e.start,o=e.end,a=t.start,i=t.end;return r(n,a,i)!==r(o,a,i)&&r(n,o,a)!==r(n,o,i)} },{"three":"dKqR","stats.js":"dnrf","dat.gui":"KkZG","three/examples/jsm/controls/OrbitControls.js":"xTGv","../src/index.js":"uBxZ"}]},{},["jNWJ"], null) \ No newline at end of file